Skip to content

Commit

Permalink
[Add] TeamSparker#384 - 마이페이지 알림 뷰 및 셀 초기구현
Browse files Browse the repository at this point in the history
  • Loading branch information
hyun99999 committed Mar 26, 2022
1 parent f21bca8 commit 5716498
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 6 deletions.
8 changes: 8 additions & 0 deletions Spark-iOS/Spark-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@
F8B18E0327EF9903001A1A7D /* WithdrawalCellDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8B18E0227EF9903001A1A7D /* WithdrawalCellDelegate.swift */; };
F8B18E0527EFA19E001A1A7D /* NotificationVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8B18E0427EFA19E001A1A7D /* NotificationVC.swift */; };
F8B18E0727EFA1AA001A1A7D /* Notification.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F8B18E0627EFA1AA001A1A7D /* Notification.storyboard */; };
F8B18E0927EFA43F001A1A7D /* NotificationHeaderTVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8B18E0827EFA43F001A1A7D /* NotificationHeaderTVC.swift */; };
F8B18E0B27EFA453001A1A7D /* NotificationTVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8B18E0A27EFA453001A1A7D /* NotificationTVC.swift */; };
F8C14A9B2795094800498687 /* HomeEmptyCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8C14A992795094800498687 /* HomeEmptyCVC.swift */; };
F8C14A9C2795094800498687 /* HomeEmptyCVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = F8C14A9A2795094800498687 /* HomeEmptyCVC.xib */; };
F8C3659527DBB82A000AA9BD /* CompleteFailDialogueVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8C3659427DBB82A000AA9BD /* CompleteFailDialogueVC.swift */; };
Expand Down Expand Up @@ -417,6 +419,8 @@
F8B18E0227EF9903001A1A7D /* WithdrawalCellDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WithdrawalCellDelegate.swift; sourceTree = "<group>"; };
F8B18E0427EFA19E001A1A7D /* NotificationVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationVC.swift; sourceTree = "<group>"; };
F8B18E0627EFA1AA001A1A7D /* Notification.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Notification.storyboard; sourceTree = "<group>"; };
F8B18E0827EFA43F001A1A7D /* NotificationHeaderTVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationHeaderTVC.swift; sourceTree = "<group>"; };
F8B18E0A27EFA453001A1A7D /* NotificationTVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationTVC.swift; sourceTree = "<group>"; };
F8C14A992795094800498687 /* HomeEmptyCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeEmptyCVC.swift; sourceTree = "<group>"; };
F8C14A9A2795094800498687 /* HomeEmptyCVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomeEmptyCVC.xib; sourceTree = "<group>"; };
F8C3659427DBB82A000AA9BD /* CompleteFailDialogueVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompleteFailDialogueVC.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1345,6 +1349,8 @@
F8E4DFD527D0918C00128B1F /* MypageProfileTVC.swift */,
F8E4DFD727D09F7A00128B1F /* MypageDefaultTVC.swift */,
F8E4DFD927D0DE3700128B1F /* MypageTableHeaderView.swift */,
F8B18E0827EFA43F001A1A7D /* NotificationHeaderTVC.swift */,
F8B18E0A27EFA453001A1A7D /* NotificationTVC.swift */,
);
path = Mypage;
sourceTree = "<group>";
Expand Down Expand Up @@ -1671,6 +1677,7 @@
F8E4DFD627D0918C00128B1F /* MypageProfileTVC.swift in Sources */,
F821813527DE659E00DDFBF8 /* SparkTabBarController.swift in Sources */,
F8B18E0527EFA19E001A1A7D /* NotificationVC.swift in Sources */,
F8B18E0B27EFA453001A1A7D /* NotificationTVC.swift in Sources */,
F80A3E57278C1C2700728E07 /* FeedVC.swift in Sources */,
EB9C50842792A61D00588155 /* HabitAuthVC.swift in Sources */,
2BC17277278F765C00BA3029 /* WaitingFriendCVC.swift in Sources */,
Expand Down Expand Up @@ -1701,6 +1708,7 @@
F82F5802279287FD003E4174 /* HabitRoom.swift in Sources */,
F82B2E12278F54CD00219628 /* SplashVC.swift in Sources */,
F8E4DFDA27D0DE3700128B1F /* MypageTableHeaderView.swift in Sources */,
F8B18E0927EFA43F001A1A7D /* NotificationHeaderTVC.swift in Sources */,
F8404E8B27AB835F004AEDC3 /* SendSparkButton.swift in Sources */,
F82F580427928975003E4174 /* MoyaLoggerPlugin.swift in Sources */,
F8096F2927841F1E00B71D38 /* Const.swift in Sources */,
Expand Down
2 changes: 2 additions & 0 deletions Spark-iOS/Spark-iOS/Resource/Constants/Cell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ extension Const {
static let noticeServiceCVC = "NoticeServiceCVC"
static let onboardingCVC = "OnboardingCVC"
static let habitRoomGuideCVC = "HabitRoomGuideCVC"
static let notificationHeaderTVC = "NotificationHeaderTVC"
static let notificationTVC = "NotificationTVC"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17150" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17122"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<!--NotificationVC-->
<scene sceneID="s0d-6b-0kx">
<objects>
<viewController id="Y6W-OH-hqX" sceneMemberID="viewController">
<viewController storyboardIdentifier="NotificationVC" id="Y6W-OH-hqX" customClass="NotificationVC" customModule="Spark_iOS" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="5EZ-qb-Rvc">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand All @@ -20,6 +22,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-23" y="116"/>
</scene>
</scenes>
<resources>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// NotificationHeaderTVC.swift
// Spark-iOS
//
// Created by kimhyungyu on 2022/03/27.
//

import UIKit

class NotificationHeaderTVC: UITableViewCell {

override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}

override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)

// Configure the view for the selected state
}

}
23 changes: 23 additions & 0 deletions Spark-iOS/Spark-iOS/Source/Cells/Mypage/NotificationTVC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// NotificationTVC.swift
// Spark-iOS
//
// Created by kimhyungyu on 2022/03/27.
//

import UIKit

class NotificationTVC: UITableViewCell {

override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}

override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)

// Configure the view for the selected state
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ extension MypageVC {
tableView.sectionHeaderTopPadding = 0
}
}

}

// MARK: - UITableViewDelegate
Expand Down Expand Up @@ -144,7 +143,9 @@ extension MypageVC: UITableViewDelegate {
editProfileVC.modalPresentationStyle = .overFullScreen
present(editProfileVC, animated: true, completion: nil)
case .setting:
return
guard let notificationVC = UIStoryboard(name: Const.Storyboard.Name.notification, bundle: nil).instantiateViewController(withIdentifier: Const.ViewController.Identifier.notification) as? NotificationVC else { return }

navigationController?.pushViewController(notificationVC, animated: true)
case .center:
if MFMailComposeViewController.canSendMail() {
guard let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String else { return }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,22 @@

import UIKit

import SnapKit

class NotificationVC: UIViewController {

// MARK: - Properties

private let customNavigationBar = LeftButtonNavigaitonBar()
private let tableView = UITableView()

// MARK: - View Life Cycle

override func viewDidLoad() {
super.viewDidLoad()

setUI()
setTableView()
setLayout()
}
}
Expand All @@ -25,14 +31,64 @@ class NotificationVC: UIViewController {

extension NotificationVC {
private func setUI() {
customNavigationBar.title("알림")
.leftButtonImage("icBackWhite")
.leftButtonAction {
self.navigationController?.popViewController(animated: true)
}
}

private func setTableView() {
tableView.delegate = self
tableView.dataSource = self

tableView.register(NotificationHeaderTVC.self, forCellReuseIdentifier: Const.Cell.Identifier.notificationHeaderTVC)
tableView.register(NotificationTVC.self, forCellReuseIdentifier: Const.Cell.Identifier.notificationTVC)

tableView.showsVerticalScrollIndicator = false
tableView.separatorStyle = .none

// iOS 15.0 이상에서 section header 상단에 간격이 생겨서 삭제.
if #available(iOS 15.0, *) {
tableView.sectionHeaderTopPadding = 0
}
}
}

// MARK: - UITableViewDelegate

extension NotificationVC: UITableViewDelegate {

}

// MARK: - UITableViewDataSource

extension NotificationVC: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
<#code#>
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
<#code#>
}
}

// MARK: - Layout

extension NotificationVC {
private func setLayout() {
view.addSubviews([customNavigationBar, tableView])

customNavigationBar.snp.makeConstraints {
$0.top.equalTo(view.safeAreaLayoutGuide.snp.top)
$0.leading.trailing.equalToSuperview()
$0.height.equalTo(60)
}

tableView.snp.makeConstraints {
$0.leading.trailing.equalToSuperview()
$0.top.equalTo(customNavigationBar.snp.bottom)
$0.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom)
}
}
}

0 comments on commit 5716498

Please sign in to comment.