Skip to content

Commit

Permalink
feat: #38 Add NavigationCoordinator
Browse files Browse the repository at this point in the history
  • Loading branch information
zaehorang committed Nov 6, 2024
1 parent e2f4b54 commit 7f598b6
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 6 deletions.
43 changes: 39 additions & 4 deletions FiveGuyes/FiveGuyes.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@
26890B992CAE811D008DFF49 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 26890B982CAE811D008DFF49 /* Assets.xcassets */; };
26890B9C2CAE811D008DFF49 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 26890B9B2CAE811D008DFF49 /* Preview Assets.xcassets */; };
26890BBD2CAE98E2008DFF49 /* .swiftlint.yml in Resources */ = {isa = PBXBuildFile; fileRef = 26890BBC2CAE98E2008DFF49 /* .swiftlint.yml */; };
26F19A682CD9EFD800F41D6D /* MainHomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26F19A672CD9EFD800F41D6D /* MainHomeView.swift */; };
26F19A6A2CD9FE5C00F41D6D /* WeeklyReadingProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26F19A692CD9FE5C00F41D6D /* WeeklyReadingProgressView.swift */; };
26F19A6C2CDA0A2B00F41D6D /* CompletionListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26F19A6B2CDA0A2B00F41D6D /* CompletionListView.swift */; };
26F19A6E2CDA74A600F41D6D /* WeeklyPageCalendarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26F19A6D2CDA74A600F41D6D /* WeeklyPageCalendarView.swift */; };
26F19A722CDB267600F41D6D /* NavigationCoodinaotr.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26F19A712CDB267600F41D6D /* NavigationCoodinaotr.swift */; };
26F19A742CDB271E00F41D6D /* NavigationRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26F19A732CDB271E00F41D6D /* NavigationRootView.swift */; };
26F19A762CDB2A5C00F41D6D /* Config.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 26F19A752CDB2A5C00F41D6D /* Config.xcconfig */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -66,6 +73,13 @@
26890B982CAE811D008DFF49 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
26890B9B2CAE811D008DFF49 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
26890BBC2CAE98E2008DFF49 /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .swiftlint.yml; sourceTree = "<group>"; };
26F19A672CD9EFD800F41D6D /* MainHomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainHomeView.swift; sourceTree = "<group>"; };
26F19A692CD9FE5C00F41D6D /* WeeklyReadingProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeeklyReadingProgressView.swift; sourceTree = "<group>"; };
26F19A6B2CDA0A2B00F41D6D /* CompletionListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompletionListView.swift; sourceTree = "<group>"; };
26F19A6D2CDA74A600F41D6D /* WeeklyPageCalendarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeeklyPageCalendarView.swift; sourceTree = "<group>"; };
26F19A712CDB267600F41D6D /* NavigationCoodinaotr.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationCoodinaotr.swift; sourceTree = "<group>"; };
26F19A732CDB271E00F41D6D /* NavigationRootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationRootView.swift; sourceTree = "<group>"; };
26F19A752CDB2A5C00F41D6D /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -109,7 +123,7 @@
26890B882CAE811A008DFF49 = {
isa = PBXGroup;
children = (
1A54142C2CDA006800283FBD /* Config.xcconfig */,
26F19A752CDB2A5C00F41D6D /* Config.xcconfig */,
26890B932CAE811A008DFF49 /* FiveGuyes */,
26890B922CAE811A008DFF49 /* Products */,
);
Expand Down Expand Up @@ -183,6 +197,7 @@
26D852F92CCE40930016239A /* Navigation */ = {
isa = PBXGroup;
children = (
26F19A732CDB271E00F41D6D /* NavigationRootView.swift */,
);
path = Navigation;
sourceTree = "<group>";
Expand All @@ -193,6 +208,8 @@
1A27D95E2CDA155B00D1E14D /* BookSearch */,
24360D4F2CD9F2D800E83D2B /* BookProgress */,
1A010EC12CD8DA4300FBE3B3 /* TotalPageView.swift */,
1A54142A2CD9FEF400283FBD /* BookSearchView.swift */,
26F19A662CD9EF9400F41D6D /* Main */,
264440512CD8A3B50031A290 /* BookCompletion */,
);
path = Screen;
Expand Down Expand Up @@ -220,6 +237,7 @@
1A010EAD2CD8A86E00FBE3B3 /* APIStore.swift */,
1A010EB52CD8AF9800FBE3B3 /* GetBookStore.swift */,
264440542CD8E0100031A290 /* KeyboardObserver.swift */,
26F19A712CDB267600F41D6D /* NavigationCoodinaotr.swift */,
);
path = Stores;
sourceTree = "<group>";
Expand All @@ -246,10 +264,21 @@
264440562CD8E0D20031A290 /* CustomTextEditorStyle.swift */,
1A27D95F2CDA31EE00D1E14D /* ProgressBar.swift */,
1A27D9612CDB05C000D1E14D /* CustomTextFieldStylePageCount.swift */,
26F19A692CD9FE5C00F41D6D /* WeeklyReadingProgressView.swift */,
26F19A6B2CDA0A2B00F41D6D /* CompletionListView.swift */,
26F19A6D2CDA74A600F41D6D /* WeeklyPageCalendarView.swift */,
);
path = Components;
sourceTree = "<group>";
};
26F19A662CD9EF9400F41D6D /* Main */ = {
isa = PBXGroup;
children = (
26F19A672CD9EFD800F41D6D /* MainHomeView.swift */,
);
path = Main;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -312,7 +341,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1A54142D2CDA006800283FBD /* Config.xcconfig in Resources */,
26F19A762CDB2A5C00F41D6D /* Config.xcconfig in Resources */,
26890BBD2CAE98E2008DFF49 /* .swiftlint.yml in Resources */,
26890B9C2CAE811D008DFF49 /* Preview Assets.xcassets in Resources */,
26890B992CAE811D008DFF49 /* Assets.xcassets in Resources */,
Expand All @@ -337,18 +366,24 @@
1A27D9602CDA31EE00D1E14D /* ProgressBar.swift in Sources */,
1A27D9622CDB05C000D1E14D /* CustomTextFieldStylePageCount.swift in Sources */,
1A010EB62CD8AF9800FBE3B3 /* GetBookStore.swift in Sources */,
26F19A722CDB267600F41D6D /* NavigationCoodinaotr.swift in Sources */,
264440592CD8F6020031A290 /* CustomBackButton.swift in Sources */,
24360D4A2CD8BE3C00E83D2B /* FinishGoalView.swift in Sources */,
24360D4C2CD9CF9700E83D2B /* MainView.swift in Sources */,
26F19A682CD9EFD800F41D6D /* MainHomeView.swift in Sources */,
26F19A742CDB271E00F41D6D /* NavigationRootView.swift in Sources */,
24360D462CD8A2F800E83D2B /* EmptyDataMainView.swift in Sources */,
264440502CD8A3AC0031A290 /* CompletionReviewView.swift in Sources */,
264440502CD8A3AC0031A290 /* CompletionReviewView.swift in Sources */,
26890B952CAE811A008DFF49 /* FiveGuyesApp.swift in Sources */,
24360D482CD8BAF100E83D2B /* EmptyNotiView.swift in Sources */,
26F19A6E2CDA74A600F41D6D /* WeeklyPageCalendarView.swift in Sources */,
264440532CD8B1540031A290 /* String+Extension.swift in Sources */,
264440572CD8E0D20031A290 /* CustomTextEditorStyle.swift in Sources */,
264440552CD8E0100031A290 /* KeyboardObserver.swift in Sources */,
26F19A6C2CDA0A2B00F41D6D /* CompletionListView.swift in Sources */,
2644404E2CD8A39E0031A290 /* CompletionCelebrationView.swift in Sources */,
26F19A6A2CD9FE5C00F41D6D /* WeeklyReadingProgressView.swift in Sources */,
2644405B2CD8F9380031A290 /* UINavigationController+Extension.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -365,7 +400,7 @@
/* Begin XCBuildConfiguration section */
26890B9D2CAE811D008DFF49 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 1A54142C2CDA006800283FBD /* Config.xcconfig */;
baseConfigurationReference = 26F19A752CDB2A5C00F41D6D /* Config.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
Expand Down Expand Up @@ -429,7 +464,7 @@
};
26890B9E2CAE811D008DFF49 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 1A54142C2CDA006800283FBD /* Config.xcconfig */;
baseConfigurationReference = 26F19A752CDB2A5C00F41D6D /* Config.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"originHash" : "1fa961aa1dc717cea452f3389668f0f99a254f07e4eb11d190768a53798f744f",
"pins" : [
{
"identity" : "swiftlintplugins",
Expand All @@ -11,5 +10,5 @@
}
}
],
"version" : 3
"version" : 2
}
45 changes: 45 additions & 0 deletions FiveGuyes/FiveGuyes/Sources/Stores/NavigationCoodinaotr.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// NavigationCoodinaotr.swift
// FiveGuyes
//
// Created by zaehorang on 11/6/24.
//

import SwiftUI

// TODO: ์ถ”๊ฐ€๋˜๋Š” ๋ทฐ ์ถ”๊ฐ€ํ•˜๊ธฐ
enum Screens {
case mainHome
case empthNoti
case bookSearch
}

@Observable
final class NavigationCoordinator {
var paths = NavigationPath()

@ViewBuilder
func navigate(to screen: Screens) -> some View {
// TODO: ์ถ”๊ฐ€๋˜๋Š” ๋ทฐ ์ถ”๊ฐ€ํ•˜๊ธฐ
switch screen {
case .mainHome: MainHomeView()
case .empthNoti: EmptyNotiView()
case .bookSearch: BookSearchView()
}
}

// add screen
func push(_ screen: Screens) {
paths.append(screen)
}

// remove last screen
func pop() {
paths.removeLast()
}

// go to root screen
func popToRoot() {
paths.removeLast(paths.count)
}
}

0 comments on commit 7f598b6

Please sign in to comment.