Skip to content

Commit

Permalink
Merge pull request #152 from OMZigak/feat/146-schedule-detail
Browse files Browse the repository at this point in the history
[feat] 약속 상세 화면 중간 PR 및 NavigationBar 두개 겹치는 문제 해결, mainTabBar 색상 변경
  • Loading branch information
youz2me authored Jul 9, 2024
2 parents c119e30 + e65bcca commit f9ea74f
Show file tree
Hide file tree
Showing 11 changed files with 335 additions and 29 deletions.
32 changes: 32 additions & 0 deletions KkuMulKum.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@
DDAF1C7E2C3D5B86008A37D3 /* RxRelay in Frameworks */ = {isa = PBXBuildFile; productRef = DDAF1C7D2C3D5B86008A37D3 /* RxRelay */; };
DDAF1C812C3D5BD5008A37D3 /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = DDAF1C802C3D5BD5008A37D3 /* Kingfisher */; };
DDAF1C842C3D5D19008A37D3 /* ViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF1C832C3D5D19008A37D3 /* ViewModelType.swift */; };
DDAF1C8E2C3D6E3D008A37D3 /* ReadyStatusViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF1C882C3D6E3D008A37D3 /* ReadyStatusViewController.swift */; };
DDAF1C8F2C3D6E3D008A37D3 /* PromiseSegmentedControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF1C892C3D6E3D008A37D3 /* PromiseSegmentedControl.swift */; };
DDAF1C902C3D6E3D008A37D3 /* PromiseViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF1C8A2C3D6E3D008A37D3 /* PromiseViewModel.swift */; };
DDAF1C912C3D6E3D008A37D3 /* TardyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF1C8B2C3D6E3D008A37D3 /* TardyViewController.swift */; };
DDAF1C922C3D6E3D008A37D3 /* PromiseInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF1C8C2C3D6E3D008A37D3 /* PromiseInfoViewController.swift */; };
DDAF1C932C3D6E3D008A37D3 /* PromiseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAF1C8D2C3D6E3D008A37D3 /* PromiseViewController.swift */; };
DE254AA52C31131600A4015E /* Color.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DE254AA42C31131600A4015E /* Color.xcassets */; };
DE254AA82C3118EA00A4015E /* UIView+.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE254AA72C3118EA00A4015E /* UIView+.swift */; };
DE254AAA2C31190E00A4015E /* UIStackView+.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE254AA92C31190E00A4015E /* UIStackView+.swift */; };
Expand Down Expand Up @@ -146,6 +152,12 @@
DDA2EE762C385FC3007C6059 /* GroupListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupListViewController.swift; sourceTree = "<group>"; };
DDA2EE782C385FCF007C6059 /* MyPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageViewController.swift; sourceTree = "<group>"; };
DDAF1C832C3D5D19008A37D3 /* ViewModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModelType.swift; sourceTree = "<group>"; };
DDAF1C882C3D6E3D008A37D3 /* ReadyStatusViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReadyStatusViewController.swift; sourceTree = "<group>"; };
DDAF1C892C3D6E3D008A37D3 /* PromiseSegmentedControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PromiseSegmentedControl.swift; sourceTree = "<group>"; };
DDAF1C8A2C3D6E3D008A37D3 /* PromiseViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PromiseViewModel.swift; sourceTree = "<group>"; };
DDAF1C8B2C3D6E3D008A37D3 /* TardyViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TardyViewController.swift; sourceTree = "<group>"; };
DDAF1C8C2C3D6E3D008A37D3 /* PromiseInfoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PromiseInfoViewController.swift; sourceTree = "<group>"; };
DDAF1C8D2C3D6E3D008A37D3 /* PromiseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PromiseViewController.swift; sourceTree = "<group>"; };
DE254AA42C31131600A4015E /* Color.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Color.xcassets; sourceTree = "<group>"; };
DE254AA72C3118EA00A4015E /* UIView+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+.swift"; sourceTree = "<group>"; };
DE254AA92C31190E00A4015E /* UIStackView+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -342,6 +354,19 @@
path = Protocol;
sourceTree = "<group>";
};
DDAF1C872C3D6E3D008A37D3 /* Promise */ = {
isa = PBXGroup;
children = (
DDAF1C882C3D6E3D008A37D3 /* ReadyStatusViewController.swift */,
DDAF1C892C3D6E3D008A37D3 /* PromiseSegmentedControl.swift */,
DDAF1C8A2C3D6E3D008A37D3 /* PromiseViewModel.swift */,
DDAF1C8B2C3D6E3D008A37D3 /* TardyViewController.swift */,
DDAF1C8C2C3D6E3D008A37D3 /* PromiseInfoViewController.swift */,
DDAF1C8D2C3D6E3D008A37D3 /* PromiseViewController.swift */,
);
path = Promise;
sourceTree = "<group>";
};
DE254AA12C31106700A4015E /* Application */ = {
isa = PBXGroup;
children = (
Expand All @@ -359,6 +384,7 @@
DDA2EE7C2C38607F007C6059 /* GroupList */,
DDA2EE7D2C386087007C6059 /* MyPage */,
DD865B652C3920F600C351A2 /* Onboarding */,
DDAF1C872C3D6E3D008A37D3 /* Promise */,
);
path = Source;
sourceTree = "<group>";
Expand Down Expand Up @@ -695,6 +721,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
DDAF1C8E2C3D6E3D008A37D3 /* ReadyStatusViewController.swift in Sources */,
DED5DBF22C34534A006ECE7E /* BaseCollectionReusableView.swift in Sources */,
DED5DBEC2C345210006ECE7E /* BaseViewController.swift in Sources */,
DD30721A2C3C011600416D9F /* AddPromiseRequestModel.swift in Sources */,
Expand All @@ -712,11 +739,15 @@
DE254AAC2C31192400A4015E /* UILabel+.swift in Sources */,
DE254AB72C3119D000A4015E /* ReuseIdentifiable.swift in Sources */,
DDA2EE752C385FB1007C6059 /* HomeViewController.swift in Sources */,
DDAF1C922C3D6E3D008A37D3 /* PromiseInfoViewController.swift in Sources */,
DE254AB42C31199B00A4015E /* UITextField+.swift in Sources */,
DDAF1C912C3D6E3D008A37D3 /* TardyViewController.swift in Sources */,
DE8248002C36E857000601BC /* ObservablePattern.swift in Sources */,
DDAF1C902C3D6E3D008A37D3 /* PromiseViewModel.swift in Sources */,
DE254AAA2C31190E00A4015E /* UIStackView+.swift in Sources */,
DED5DBF02C345317006ECE7E /* BaseCollectionViewCell.swift in Sources */,
DE32D1D42C3BFB56006848DF /* UpdateProfileNameModel.swift in Sources */,
DDAF1C932C3D6E3D008A37D3 /* PromiseViewController.swift in Sources */,
DE9E18922C3BCC9D00DB76B4 /* SocialLoginRequestModel.swift in Sources */,
DE254AA82C3118EA00A4015E /* UIView+.swift in Sources */,
DE254AAE2C31193600A4015E /* UIFont+.swift in Sources */,
Expand All @@ -735,6 +766,7 @@
A3FB185B2C3BF7DF001483E5 /* MeetingMembersResponseModel.swift in Sources */,
DD3072222C3C0DA300416D9F /* PromiseParticipantListResponseModel.swift in Sources */,
789873322C3D1A7B00435E96 /* LoginViewController.swift in Sources */,
DDAF1C8F2C3D6E3D008A37D3 /* PromiseSegmentedControl.swift in Sources */,
DE32D1D22C3BF703006848DF /* LoginUserResponseModel.swift in Sources */,
DE9E18892C3BC91000DB76B4 /* ResponseBodyDTO.swift in Sources */,
DD3072202C3C0D4500416D9F /* MyReadyStatusResponseModel.swift in Sources */,
Expand Down
3 changes: 2 additions & 1 deletion KkuMulKum/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
//
// Created by 이지훈 on 6/24/24.
//

import UIKit

import KakaoSDKCommon
import KakaoSDKAuth

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
Expand Down
28 changes: 13 additions & 15 deletions KkuMulKum/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,25 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
) {
guard let windowScene = (scene as? UIWindowScene) else { return }
self.window = UIWindow(windowScene: windowScene)
let navigationController = UINavigationController(rootViewController: LoginViewController())
self.window?.rootViewController = navigationController
self.window?.rootViewController = MainTabBarController()
self.window?.makeKeyAndVisible()
}

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
if let url = URLContexts.first?.url {
if (AuthApi.isKakaoTalkLoginUrl(url)) {
_ = AuthController.handleOpenUrl(url: url)
}
}
}

if let url = URLContexts.first?.url {
if (AuthApi.isKakaoTalkLoginUrl(url)) {
_ = AuthController.handleOpenUrl(url: url)
}
}
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if (AuthApi.isKakaoTalkLoginUrl(url)) {
return AuthController.handleOpenUrl(url: url)
}
return false
}
if (AuthApi.isKakaoTalkLoginUrl(url)) {
return AuthController.handleOpenUrl(url: url)
}
return false
}


func sceneDidDisconnect(_ scene: UIScene) {}
func sceneDidBecomeActive(_ scene: UIScene) {}
func sceneWillResignActive(_ scene: UIScene) {}
Expand Down
22 changes: 19 additions & 3 deletions KkuMulKum/Source/Core/MainTabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,27 @@ final class MainTabBarController: UITabBarController {

tabBar.unselectedItemTintColor = .gray2
tabBar.tintColor = .maincolor
tabBar.backgroundColor = .white

let homeNavigationController = UINavigationController(rootViewController: homeViewController).then {
$0.navigationBar.topItem?.backButtonDisplayMode = .minimal
$0.navigationBar.tintColor = .black
}

let groupListNavigationController = UINavigationController(rootViewController: groupListViewController).then {
$0.navigationBar.topItem?.backButtonDisplayMode = .minimal
$0.navigationBar.tintColor = .black
}

let myPageViewNavigationController = UINavigationController(rootViewController: myPageViewController).then {
$0.navigationBar.topItem?.backButtonDisplayMode = .minimal
$0.navigationBar.tintColor = .black
}

setViewControllers([
UINavigationController(rootViewController: homeViewController),
UINavigationController(rootViewController: groupListViewController),
UINavigationController(rootViewController: myPageViewController)
homeNavigationController,
groupListNavigationController,
myPageViewNavigationController
], animated: true)
}
}
26 changes: 16 additions & 10 deletions KkuMulKum/Source/GroupList/GroupListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,29 @@

import UIKit

import SnapKit

class GroupListViewController: BaseViewController {
private lazy var button: CustomButton = CustomButton(title: "모임 추가하기", isEnabled: true).then {
$0.addTarget(self, action: #selector(didAddScheduleButtonTapped), for: .touchUpInside)
}

override func viewDidLoad() {
super.viewDidLoad()

view.backgroundColor = .white

view.addSubview(button)

button.snp.makeConstraints {
$0.top.equalToSuperview().offset(206)
$0.leading.trailing.equalToSuperview().inset(20)
}
}


/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
@objc private func didAddScheduleButtonTapped() {
let scheduleViewController = PromiseViewController()

self.navigationController?.pushViewController(scheduleViewController, animated: true)
}
*/

}
29 changes: 29 additions & 0 deletions KkuMulKum/Source/Promise/PromiseInfoViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// PromiseInfoViewController.swift
// KkuMulKum
//
// Created by YOUJIM on 7/9/24.
//

import UIKit

class PromiseInfoViewController: BaseViewController {

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
}


/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/

}
81 changes: 81 additions & 0 deletions KkuMulKum/Source/Promise/PromiseSegmentedControl.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
//
// PromiseSegmentedControl.swift
// KkuMulKum
//
// Created by YOUJIM on 7/9/24.
//

import UIKit

import SnapKit

class PromiseSegmentedControl: UISegmentedControl {
private let backgroundLineView: UIView = UIView().then {
$0.backgroundColor = .gray2
}

let selectedUnderLineView: UIView = UIView().then {
$0.backgroundColor = .black
$0.layer.cornerRadius = 1
}

override init(items: [Any]?) {
super.init(items: items)

setupSegment()
setupTextAttribute()
setupBackgroundLineView()
setupBackgroundAndDivider()

}

required init?(coder: NSCoder) {
fatalError()
}

private func setupSegment() {
[
backgroundLineView,
selectedUnderLineView
].forEach { addSubview($0) }

self.selectedSegmentIndex = 0
}

private func setupBackgroundAndDivider() {
self.setBackgroundImage(UIImage(), for: .normal, barMetrics: .default)
self.setBackgroundImage(UIImage(), for: .selected, barMetrics: .default)
self.setBackgroundImage(UIImage(), for: .highlighted, barMetrics: .default)

self.setDividerImage(
UIImage(),
forLeftSegmentState: .selected,
rightSegmentState: .normal,
barMetrics: .default
)
}

private func setupTextAttribute() {
setTitleTextAttributes([
NSAttributedString.Key.foregroundColor: UIColor.gray3,
NSAttributedString.Key.font: UIFont.pretendard(.body05)
], for: .normal)
setTitleTextAttributes([
NSAttributedString.Key.foregroundColor: UIColor.black,
NSAttributedString.Key.font: UIFont.pretendard(.body05)
], for: .selected)
}

private func setupBackgroundLineView() {
backgroundLineView.snp.makeConstraints {
$0.bottom.leading.trailing.equalToSuperview()
$0.height.equalTo(2)
}

selectedUnderLineView.snp.makeConstraints {
$0.bottom.leading.equalToSuperview()
$0.width.equalToSuperview().dividedBy(numberOfSegments)
$0.height.equalTo(backgroundLineView)
}
}
}
70 changes: 70 additions & 0 deletions KkuMulKum/Source/Promise/PromiseViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// PromiseViewController.swift
// KkuMulKum
//
// Created by YOUJIM on 7/9/24.
//

import UIKit

class PromiseViewController: BaseViewController {
private let promiseViewModel = PromiseViewModel()

private lazy var promiseSegmentedControl = PromiseSegmentedControl(items: ["약속 정보",
"준비 현황",
"지각 꾸물이"])

private let promisePageViewController = UIPageViewController(transitionStyle: .scroll,
navigationOrientation: .horizontal)

override func viewDidLoad() {
super.viewDidLoad()
}

override func setupView() {
view.backgroundColor = .white
self.navigationItem.title = "기말고사 모각작"

view.addSubview(promiseSegmentedControl)
addChild(promisePageViewController)

promiseSegmentedControl.snp.makeConstraints {
$0.top.equalToSuperview()
$0.leading.trailing.equalToSuperview().inset(-6)
$0.height.equalTo(52)
}

promisePageViewController.view.snp.makeConstraints {
$0.top.equalTo(promiseSegmentedControl.snp.bottom)
$0.horizontalEdges.bottom.equalToSuperview()
}

promisePageViewController.didMove(toParent: self)
}

override func setupAction() {
promiseSegmentedControl.addTarget(self, action: #selector(didSegmentedControlIndexUpdated), for: .valueChanged)
}

override func setupDelegate() {
promisePageViewController.delegate = self
promisePageViewController.dataSource = self
}

@objc private func didSegmentedControlIndexUpdated() {
promiseSegmentedControl.selectedUnderLineView.snp.updateConstraints {
$0.leading.equalToSuperview().offset((promiseSegmentedControl.bounds.width / CGFloat(promiseSegmentedControl.numberOfSegments)) * CGFloat(promiseSegmentedControl.selectedSegmentIndex))
}
}
}


extension BaseViewController: UIPageViewControllerDelegate, UIPageViewControllerDataSource {
func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? {
return UIViewController()
}

func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? {
return UIViewController()
}
}
Loading

0 comments on commit f9ea74f

Please sign in to comment.