├── .gitignore ├── LICENSE ├── README.md ├── SimpleNavigation.xcodeproj ├── project.pbxproj └── xcshareddata │ └── xcschemes │ └── SimpleNavigation.xcscheme └── SimpleNavigation ├── Application ├── AppDelegate.swift ├── Content │ ├── Navigation │ │ ├── Coordinator.swift │ │ └── Navigable.swift │ ├── Screens │ │ ├── Account │ │ │ ├── AccountCoordinator.swift │ │ │ ├── AccountCoordinatorView.swift │ │ │ ├── ViewModels │ │ │ │ ├── AccountConfirmViewModel.swift │ │ │ │ ├── AccountEditViewModel.swift │ │ │ │ └── AccountViewModel.swift │ │ │ └── Views │ │ │ │ ├── AccountConfirmView.swift │ │ │ │ ├── AccountEditView.swift │ │ │ │ └── AccountView.swift │ │ ├── AppCoordinator.swift │ │ ├── AppCoordinatorView.swift │ │ ├── Feed │ │ │ ├── FeedCoordinator.swift │ │ │ ├── FeedCoordinatorView.swift │ │ │ ├── ViewModels │ │ │ │ └── FeedViewModel.swift │ │ │ └── Views │ │ │ │ ├── FeedItemView.swift │ │ │ │ └── FeedView.swift │ │ ├── Item │ │ │ ├── ItemCoordinator.swift │ │ │ ├── ItemCoordinatorView.swift │ │ │ ├── ViewModels │ │ │ │ ├── ItemDetailsViewModel.swift │ │ │ │ └── ItemViewModel.swift │ │ │ └── Views │ │ │ │ ├── ItemDetailsView.swift │ │ │ │ └── ItemView.swift │ │ └── Launch │ │ │ └── Base.lproj │ │ │ └── LaunchScreen.storyboard │ └── SharedViews │ │ ├── LazyLoadView.swift │ │ └── LazyNavigationLink.swift └── SceneDelegate.swift ├── Entities ├── Feed.swift └── ItemId.swift ├── Info.plist └── Resources ├── Assets.xcassets ├── AccentColor.colorset │ └── Contents.json ├── AppIcon.appiconset │ └── Contents.json └── Contents.json └── en.lproj └── Localizable.strings /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | *.xcodeproj/project.xcworkspace/contents.xcworkspacedata 3 | *.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist 4 | !*.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved 5 | !*.xcodeproj/project.pbxproj 6 | !*.xcodeproj/xcshareddata/ 7 | !*.xcworkspace/contents.xcworkspacedata 8 | 9 | ## User settings 10 | xcuserdata/ 11 | 12 | ## GCC patch 13 | /*.gcno 14 | 15 | # SPM 16 | SourcePackages/ 17 | 18 | ## General 19 | .DS_Store 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2021 Erik Lopez 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SimpleNavigation 2 | 3 | 4 | 5 | Simple iOS app to showcase the use of the Coordinator pattern using SwiftUI and MVVM. 6 | 7 | The implementation is as easy as calling a `push` and `pop` methods on the `Coordinator`s. This approach deallocates automatically the view model and coordinator instances when they are popped from the navigation stack and the `View`s are only re-rendered when needed. 8 | 9 | ## Usage 10 | 11 | 1. Clone this repository. 12 | 2. Open the project with Xcode. 13 | 3. Enjoy. 14 | 15 | ## License 16 | 17 | Licensed under MIT 18 | 19 | -------------------------------------------------------------------------------- /SimpleNavigation.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 55; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 55C57B6627855CD6007D7905 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57B6527855CD6007D7905 /* AppDelegate.swift */; }; 11 | 55C57B6827855CD6007D7905 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57B6727855CD6007D7905 /* SceneDelegate.swift */; }; 12 | 55C57B6F27855CD8007D7905 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 55C57B6E27855CD8007D7905 /* Assets.xcassets */; }; 13 | 55C57B7227855CD8007D7905 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 55C57B7027855CD8007D7905 /* LaunchScreen.storyboard */; }; 14 | 55C57B9627855E10007D7905 /* AppCoordinatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57B9527855E10007D7905 /* AppCoordinatorView.swift */; }; 15 | 55C57B982785657C007D7905 /* FeedCoordinatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57B972785657C007D7905 /* FeedCoordinatorView.swift */; }; 16 | 55C57B9A2785711A007D7905 /* ItemCoordinatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57B992785711A007D7905 /* ItemCoordinatorView.swift */; }; 17 | 55C57B9C27857848007D7905 /* AccountCoordinatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57B9B27857848007D7905 /* AccountCoordinatorView.swift */; }; 18 | 55C57B9E27857F6D007D7905 /* Coordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57B9D27857F6D007D7905 /* Coordinator.swift */; }; 19 | 55C57BA12785816D007D7905 /* LazyLoadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BA02785816D007D7905 /* LazyLoadView.swift */; }; 20 | 55C57BA327858185007D7905 /* FeedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BA227858185007D7905 /* FeedView.swift */; }; 21 | 55C57BA52785819D007D7905 /* FeedItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BA42785819C007D7905 /* FeedItemView.swift */; }; 22 | 55C57BA8278587E5007D7905 /* ItemCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BA7278587E5007D7905 /* ItemCoordinator.swift */; }; 23 | 55C57BAA278587FB007D7905 /* ItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BA9278587FB007D7905 /* ItemView.swift */; }; 24 | 55C57BAC27858810007D7905 /* ItemViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BAB27858810007D7905 /* ItemViewModel.swift */; }; 25 | 55C57BAF27858C09007D7905 /* AccountCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BAE27858C09007D7905 /* AccountCoordinator.swift */; }; 26 | 55C57BB127858C63007D7905 /* AccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BB027858C63007D7905 /* AccountView.swift */; }; 27 | 55C57BB327858E4B007D7905 /* FeedCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BB227858E4B007D7905 /* FeedCoordinator.swift */; }; 28 | 55C57BB527858EB3007D7905 /* FeedViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BB427858EB3007D7905 /* FeedViewModel.swift */; }; 29 | 55C57BB72786B2CA007D7905 /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BB62786B2CA007D7905 /* AppCoordinator.swift */; }; 30 | 55C57BBA278D12D4007D7905 /* ItemId.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BB9278D12D4007D7905 /* ItemId.swift */; }; 31 | 55C57BC3278D26BD007D7905 /* ItemDetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BC2278D26BD007D7905 /* ItemDetailsView.swift */; }; 32 | 55C57BC5278D274F007D7905 /* ItemDetailsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BC4278D274F007D7905 /* ItemDetailsViewModel.swift */; }; 33 | 55C57BC7278D6122007D7905 /* AccountEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BC6278D6122007D7905 /* AccountEditView.swift */; }; 34 | 55C57BC9278D63E1007D7905 /* AccountEditViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BC8278D63E1007D7905 /* AccountEditViewModel.swift */; }; 35 | 55C57BCB278D6462007D7905 /* AccountConfirmView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BCA278D6462007D7905 /* AccountConfirmView.swift */; }; 36 | 55C57BCD278D66FA007D7905 /* AccountConfirmViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BCC278D66FA007D7905 /* AccountConfirmViewModel.swift */; }; 37 | 55C57BCF278D736A007D7905 /* Feed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BCE278D736A007D7905 /* Feed.swift */; }; 38 | 55C57BD1278D7634007D7905 /* Navigable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BD0278D7634007D7905 /* Navigable.swift */; }; 39 | 55C57BD3278D7E63007D7905 /* AccountViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BD2278D7E63007D7905 /* AccountViewModel.swift */; }; 40 | 55C57BD6278E79C5007D7905 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 55C57BD8278E79C5007D7905 /* Localizable.strings */; }; 41 | 55C57BDD278EC120007D7905 /* LazyNavigationLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C57BDC278EC120007D7905 /* LazyNavigationLink.swift */; }; 42 | /* End PBXBuildFile section */ 43 | 44 | /* Begin PBXFileReference section */ 45 | 55C57B6227855CD6007D7905 /* SimpleNavigation.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimpleNavigation.app; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 55C57B6527855CD6007D7905 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 47 | 55C57B6727855CD6007D7905 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 48 | 55C57B6E27855CD8007D7905 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 49 | 55C57B7127855CD8007D7905 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 50 | 55C57B7327855CD8007D7905 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | 55C57B9527855E10007D7905 /* AppCoordinatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinatorView.swift; sourceTree = ""; }; 52 | 55C57B972785657C007D7905 /* FeedCoordinatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedCoordinatorView.swift; sourceTree = ""; }; 53 | 55C57B992785711A007D7905 /* ItemCoordinatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemCoordinatorView.swift; sourceTree = ""; }; 54 | 55C57B9B27857848007D7905 /* AccountCoordinatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountCoordinatorView.swift; sourceTree = ""; }; 55 | 55C57B9D27857F6D007D7905 /* Coordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Coordinator.swift; sourceTree = ""; }; 56 | 55C57BA02785816D007D7905 /* LazyLoadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LazyLoadView.swift; sourceTree = ""; }; 57 | 55C57BA227858185007D7905 /* FeedView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedView.swift; sourceTree = ""; }; 58 | 55C57BA42785819C007D7905 /* FeedItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedItemView.swift; sourceTree = ""; }; 59 | 55C57BA7278587E5007D7905 /* ItemCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemCoordinator.swift; sourceTree = ""; }; 60 | 55C57BA9278587FB007D7905 /* ItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemView.swift; sourceTree = ""; }; 61 | 55C57BAB27858810007D7905 /* ItemViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemViewModel.swift; sourceTree = ""; }; 62 | 55C57BAE27858C09007D7905 /* AccountCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountCoordinator.swift; sourceTree = ""; }; 63 | 55C57BB027858C63007D7905 /* AccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountView.swift; sourceTree = ""; }; 64 | 55C57BB227858E4B007D7905 /* FeedCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedCoordinator.swift; sourceTree = ""; }; 65 | 55C57BB427858EB3007D7905 /* FeedViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedViewModel.swift; sourceTree = ""; }; 66 | 55C57BB62786B2CA007D7905 /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = ""; }; 67 | 55C57BB9278D12D4007D7905 /* ItemId.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemId.swift; sourceTree = ""; }; 68 | 55C57BC2278D26BD007D7905 /* ItemDetailsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemDetailsView.swift; sourceTree = ""; }; 69 | 55C57BC4278D274F007D7905 /* ItemDetailsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemDetailsViewModel.swift; sourceTree = ""; }; 70 | 55C57BC6278D6122007D7905 /* AccountEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountEditView.swift; sourceTree = ""; }; 71 | 55C57BC8278D63E1007D7905 /* AccountEditViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountEditViewModel.swift; sourceTree = ""; }; 72 | 55C57BCA278D6462007D7905 /* AccountConfirmView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountConfirmView.swift; sourceTree = ""; }; 73 | 55C57BCC278D66FA007D7905 /* AccountConfirmViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountConfirmViewModel.swift; sourceTree = ""; }; 74 | 55C57BCE278D736A007D7905 /* Feed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Feed.swift; sourceTree = ""; }; 75 | 55C57BD0278D7634007D7905 /* Navigable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Navigable.swift; sourceTree = ""; }; 76 | 55C57BD2278D7E63007D7905 /* AccountViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountViewModel.swift; sourceTree = ""; }; 77 | 55C57BD7278E79C5007D7905 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; 78 | 55C57BDC278EC120007D7905 /* LazyNavigationLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LazyNavigationLink.swift; sourceTree = ""; }; 79 | /* End PBXFileReference section */ 80 | 81 | /* Begin PBXFrameworksBuildPhase section */ 82 | 55C57B5F27855CD6007D7905 /* Frameworks */ = { 83 | isa = PBXFrameworksBuildPhase; 84 | buildActionMask = 2147483647; 85 | files = ( 86 | ); 87 | runOnlyForDeploymentPostprocessing = 0; 88 | }; 89 | /* End PBXFrameworksBuildPhase section */ 90 | 91 | /* Begin PBXGroup section */ 92 | 55C57B5927855CD6007D7905 = { 93 | isa = PBXGroup; 94 | children = ( 95 | 55C57B6427855CD6007D7905 /* SimpleNavigation */, 96 | 55C57B6327855CD6007D7905 /* Products */, 97 | ); 98 | sourceTree = ""; 99 | }; 100 | 55C57B6327855CD6007D7905 /* Products */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 55C57B6227855CD6007D7905 /* SimpleNavigation.app */, 104 | ); 105 | name = Products; 106 | sourceTree = ""; 107 | }; 108 | 55C57B6427855CD6007D7905 /* SimpleNavigation */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 55C57BB8278D12B7007D7905 /* Entities */, 112 | 55C57BBB278D1E21007D7905 /* Application */, 113 | 55C57BBF278D1E8C007D7905 /* Resources */, 114 | 55C57BC0278D1EAC007D7905 /* Support */, 115 | ); 116 | path = SimpleNavigation; 117 | sourceTree = ""; 118 | }; 119 | 55C57B9F2785814C007D7905 /* Feed */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 55C57BB227858E4B007D7905 /* FeedCoordinator.swift */, 123 | 55C57B972785657C007D7905 /* FeedCoordinatorView.swift */, 124 | 55C57BE427953B02007D7905 /* Views */, 125 | 55C57BE527953B0E007D7905 /* ViewModels */, 126 | ); 127 | path = Feed; 128 | sourceTree = ""; 129 | }; 130 | 55C57BA6278587D0007D7905 /* Item */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 55C57BA7278587E5007D7905 /* ItemCoordinator.swift */, 134 | 55C57B992785711A007D7905 /* ItemCoordinatorView.swift */, 135 | 55C57BE627953B2C007D7905 /* Views */, 136 | 55C57BE727953B3C007D7905 /* ViewModels */, 137 | ); 138 | path = Item; 139 | sourceTree = ""; 140 | }; 141 | 55C57BAD27858BE3007D7905 /* Account */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 55C57BAE27858C09007D7905 /* AccountCoordinator.swift */, 145 | 55C57B9B27857848007D7905 /* AccountCoordinatorView.swift */, 146 | 55C57BE327953ADC007D7905 /* Views */, 147 | 55C57BE227953ACB007D7905 /* ViewModels */, 148 | ); 149 | path = Account; 150 | sourceTree = ""; 151 | }; 152 | 55C57BB8278D12B7007D7905 /* Entities */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 55C57BB9278D12D4007D7905 /* ItemId.swift */, 156 | 55C57BCE278D736A007D7905 /* Feed.swift */, 157 | ); 158 | path = Entities; 159 | sourceTree = ""; 160 | }; 161 | 55C57BBB278D1E21007D7905 /* Application */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | 55C57B6527855CD6007D7905 /* AppDelegate.swift */, 165 | 55C57B6727855CD6007D7905 /* SceneDelegate.swift */, 166 | 55C57BEA27954F62007D7905 /* Content */, 167 | ); 168 | path = Application; 169 | sourceTree = ""; 170 | }; 171 | 55C57BBC278D1E36007D7905 /* Screens */ = { 172 | isa = PBXGroup; 173 | children = ( 174 | 55C57BB62786B2CA007D7905 /* AppCoordinator.swift */, 175 | 55C57B9527855E10007D7905 /* AppCoordinatorView.swift */, 176 | 55C57BAD27858BE3007D7905 /* Account */, 177 | 55C57B9F2785814C007D7905 /* Feed */, 178 | 55C57BA6278587D0007D7905 /* Item */, 179 | 55C57BBE278D1E81007D7905 /* Launch */, 180 | ); 181 | path = Screens; 182 | sourceTree = ""; 183 | }; 184 | 55C57BBD278D1E6E007D7905 /* SharedViews */ = { 185 | isa = PBXGroup; 186 | children = ( 187 | 55C57BA02785816D007D7905 /* LazyLoadView.swift */, 188 | 55C57BDC278EC120007D7905 /* LazyNavigationLink.swift */, 189 | ); 190 | path = SharedViews; 191 | sourceTree = ""; 192 | }; 193 | 55C57BBE278D1E81007D7905 /* Launch */ = { 194 | isa = PBXGroup; 195 | children = ( 196 | 55C57B7027855CD8007D7905 /* LaunchScreen.storyboard */, 197 | ); 198 | path = Launch; 199 | sourceTree = ""; 200 | }; 201 | 55C57BBF278D1E8C007D7905 /* Resources */ = { 202 | isa = PBXGroup; 203 | children = ( 204 | 55C57B6E27855CD8007D7905 /* Assets.xcassets */, 205 | 55C57BD8278E79C5007D7905 /* Localizable.strings */, 206 | ); 207 | path = Resources; 208 | sourceTree = ""; 209 | }; 210 | 55C57BC0278D1EAC007D7905 /* Support */ = { 211 | isa = PBXGroup; 212 | children = ( 213 | 55C57B7327855CD8007D7905 /* Info.plist */, 214 | ); 215 | name = Support; 216 | sourceTree = ""; 217 | }; 218 | 55C57BC1278D2460007D7905 /* Navigation */ = { 219 | isa = PBXGroup; 220 | children = ( 221 | 55C57B9D27857F6D007D7905 /* Coordinator.swift */, 222 | 55C57BD0278D7634007D7905 /* Navigable.swift */, 223 | ); 224 | path = Navigation; 225 | sourceTree = ""; 226 | }; 227 | 55C57BE227953ACB007D7905 /* ViewModels */ = { 228 | isa = PBXGroup; 229 | children = ( 230 | 55C57BD2278D7E63007D7905 /* AccountViewModel.swift */, 231 | 55C57BCC278D66FA007D7905 /* AccountConfirmViewModel.swift */, 232 | 55C57BC8278D63E1007D7905 /* AccountEditViewModel.swift */, 233 | ); 234 | path = ViewModels; 235 | sourceTree = ""; 236 | }; 237 | 55C57BE327953ADC007D7905 /* Views */ = { 238 | isa = PBXGroup; 239 | children = ( 240 | 55C57BC6278D6122007D7905 /* AccountEditView.swift */, 241 | 55C57BCA278D6462007D7905 /* AccountConfirmView.swift */, 242 | 55C57BB027858C63007D7905 /* AccountView.swift */, 243 | ); 244 | path = Views; 245 | sourceTree = ""; 246 | }; 247 | 55C57BE427953B02007D7905 /* Views */ = { 248 | isa = PBXGroup; 249 | children = ( 250 | 55C57BA227858185007D7905 /* FeedView.swift */, 251 | 55C57BA42785819C007D7905 /* FeedItemView.swift */, 252 | ); 253 | path = Views; 254 | sourceTree = ""; 255 | }; 256 | 55C57BE527953B0E007D7905 /* ViewModels */ = { 257 | isa = PBXGroup; 258 | children = ( 259 | 55C57BB427858EB3007D7905 /* FeedViewModel.swift */, 260 | ); 261 | path = ViewModels; 262 | sourceTree = ""; 263 | }; 264 | 55C57BE627953B2C007D7905 /* Views */ = { 265 | isa = PBXGroup; 266 | children = ( 267 | 55C57BC2278D26BD007D7905 /* ItemDetailsView.swift */, 268 | 55C57BA9278587FB007D7905 /* ItemView.swift */, 269 | ); 270 | path = Views; 271 | sourceTree = ""; 272 | }; 273 | 55C57BE727953B3C007D7905 /* ViewModels */ = { 274 | isa = PBXGroup; 275 | children = ( 276 | 55C57BC4278D274F007D7905 /* ItemDetailsViewModel.swift */, 277 | 55C57BAB27858810007D7905 /* ItemViewModel.swift */, 278 | ); 279 | path = ViewModels; 280 | sourceTree = ""; 281 | }; 282 | 55C57BEA27954F62007D7905 /* Content */ = { 283 | isa = PBXGroup; 284 | children = ( 285 | 55C57BC1278D2460007D7905 /* Navigation */, 286 | 55C57BBC278D1E36007D7905 /* Screens */, 287 | 55C57BBD278D1E6E007D7905 /* SharedViews */, 288 | ); 289 | path = Content; 290 | sourceTree = ""; 291 | }; 292 | /* End PBXGroup section */ 293 | 294 | /* Begin PBXNativeTarget section */ 295 | 55C57B6127855CD6007D7905 /* SimpleNavigation */ = { 296 | isa = PBXNativeTarget; 297 | buildConfigurationList = 55C57B8C27855CD9007D7905 /* Build configuration list for PBXNativeTarget "SimpleNavigation" */; 298 | buildPhases = ( 299 | 55C57B5E27855CD6007D7905 /* Sources */, 300 | 55C57B5F27855CD6007D7905 /* Frameworks */, 301 | 55C57B6027855CD6007D7905 /* Resources */, 302 | ); 303 | buildRules = ( 304 | ); 305 | dependencies = ( 306 | ); 307 | name = SimpleNavigation; 308 | packageProductDependencies = ( 309 | ); 310 | productName = SimpleNavigation; 311 | productReference = 55C57B6227855CD6007D7905 /* SimpleNavigation.app */; 312 | productType = "com.apple.product-type.application"; 313 | }; 314 | /* End PBXNativeTarget section */ 315 | 316 | /* Begin PBXProject section */ 317 | 55C57B5A27855CD6007D7905 /* Project object */ = { 318 | isa = PBXProject; 319 | attributes = { 320 | BuildIndependentTargetsInParallel = 1; 321 | LastSwiftUpdateCheck = 1300; 322 | LastUpgradeCheck = 1300; 323 | TargetAttributes = { 324 | 55C57B6127855CD6007D7905 = { 325 | CreatedOnToolsVersion = 13.0; 326 | }; 327 | }; 328 | }; 329 | buildConfigurationList = 55C57B5D27855CD6007D7905 /* Build configuration list for PBXProject "SimpleNavigation" */; 330 | compatibilityVersion = "Xcode 13.0"; 331 | developmentRegion = en; 332 | hasScannedForEncodings = 0; 333 | knownRegions = ( 334 | en, 335 | Base, 336 | ); 337 | mainGroup = 55C57B5927855CD6007D7905; 338 | packageReferences = ( 339 | ); 340 | productRefGroup = 55C57B6327855CD6007D7905 /* Products */; 341 | projectDirPath = ""; 342 | projectRoot = ""; 343 | targets = ( 344 | 55C57B6127855CD6007D7905 /* SimpleNavigation */, 345 | ); 346 | }; 347 | /* End PBXProject section */ 348 | 349 | /* Begin PBXResourcesBuildPhase section */ 350 | 55C57B6027855CD6007D7905 /* Resources */ = { 351 | isa = PBXResourcesBuildPhase; 352 | buildActionMask = 2147483647; 353 | files = ( 354 | 55C57B7227855CD8007D7905 /* LaunchScreen.storyboard in Resources */, 355 | 55C57BD6278E79C5007D7905 /* Localizable.strings in Resources */, 356 | 55C57B6F27855CD8007D7905 /* Assets.xcassets in Resources */, 357 | ); 358 | runOnlyForDeploymentPostprocessing = 0; 359 | }; 360 | /* End PBXResourcesBuildPhase section */ 361 | 362 | /* Begin PBXSourcesBuildPhase section */ 363 | 55C57B5E27855CD6007D7905 /* Sources */ = { 364 | isa = PBXSourcesBuildPhase; 365 | buildActionMask = 2147483647; 366 | files = ( 367 | 55C57BAC27858810007D7905 /* ItemViewModel.swift in Sources */, 368 | 55C57BCF278D736A007D7905 /* Feed.swift in Sources */, 369 | 55C57BB527858EB3007D7905 /* FeedViewModel.swift in Sources */, 370 | 55C57BA12785816D007D7905 /* LazyLoadView.swift in Sources */, 371 | 55C57BA327858185007D7905 /* FeedView.swift in Sources */, 372 | 55C57BBA278D12D4007D7905 /* ItemId.swift in Sources */, 373 | 55C57BC5278D274F007D7905 /* ItemDetailsViewModel.swift in Sources */, 374 | 55C57BA8278587E5007D7905 /* ItemCoordinator.swift in Sources */, 375 | 55C57B982785657C007D7905 /* FeedCoordinatorView.swift in Sources */, 376 | 55C57BB72786B2CA007D7905 /* AppCoordinator.swift in Sources */, 377 | 55C57BD1278D7634007D7905 /* Navigable.swift in Sources */, 378 | 55C57BC3278D26BD007D7905 /* ItemDetailsView.swift in Sources */, 379 | 55C57BCD278D66FA007D7905 /* AccountConfirmViewModel.swift in Sources */, 380 | 55C57B6627855CD6007D7905 /* AppDelegate.swift in Sources */, 381 | 55C57BC9278D63E1007D7905 /* AccountEditViewModel.swift in Sources */, 382 | 55C57B9A2785711A007D7905 /* ItemCoordinatorView.swift in Sources */, 383 | 55C57BDD278EC120007D7905 /* LazyNavigationLink.swift in Sources */, 384 | 55C57BA52785819D007D7905 /* FeedItemView.swift in Sources */, 385 | 55C57BB327858E4B007D7905 /* FeedCoordinator.swift in Sources */, 386 | 55C57BAF27858C09007D7905 /* AccountCoordinator.swift in Sources */, 387 | 55C57BB127858C63007D7905 /* AccountView.swift in Sources */, 388 | 55C57BCB278D6462007D7905 /* AccountConfirmView.swift in Sources */, 389 | 55C57BC7278D6122007D7905 /* AccountEditView.swift in Sources */, 390 | 55C57BD3278D7E63007D7905 /* AccountViewModel.swift in Sources */, 391 | 55C57BAA278587FB007D7905 /* ItemView.swift in Sources */, 392 | 55C57B6827855CD6007D7905 /* SceneDelegate.swift in Sources */, 393 | 55C57B9627855E10007D7905 /* AppCoordinatorView.swift in Sources */, 394 | 55C57B9C27857848007D7905 /* AccountCoordinatorView.swift in Sources */, 395 | 55C57B9E27857F6D007D7905 /* Coordinator.swift in Sources */, 396 | ); 397 | runOnlyForDeploymentPostprocessing = 0; 398 | }; 399 | /* End PBXSourcesBuildPhase section */ 400 | 401 | /* Begin PBXVariantGroup section */ 402 | 55C57B7027855CD8007D7905 /* LaunchScreen.storyboard */ = { 403 | isa = PBXVariantGroup; 404 | children = ( 405 | 55C57B7127855CD8007D7905 /* Base */, 406 | ); 407 | name = LaunchScreen.storyboard; 408 | sourceTree = ""; 409 | }; 410 | 55C57BD8278E79C5007D7905 /* Localizable.strings */ = { 411 | isa = PBXVariantGroup; 412 | children = ( 413 | 55C57BD7278E79C5007D7905 /* en */, 414 | ); 415 | name = Localizable.strings; 416 | sourceTree = ""; 417 | }; 418 | /* End PBXVariantGroup section */ 419 | 420 | /* Begin XCBuildConfiguration section */ 421 | 55C57B8A27855CD9007D7905 /* Debug */ = { 422 | isa = XCBuildConfiguration; 423 | buildSettings = { 424 | ALWAYS_SEARCH_USER_PATHS = NO; 425 | CLANG_ANALYZER_NONNULL = YES; 426 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 427 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 428 | CLANG_CXX_LIBRARY = "libc++"; 429 | CLANG_ENABLE_MODULES = YES; 430 | CLANG_ENABLE_OBJC_ARC = YES; 431 | CLANG_ENABLE_OBJC_WEAK = YES; 432 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 433 | CLANG_WARN_BOOL_CONVERSION = YES; 434 | CLANG_WARN_COMMA = YES; 435 | CLANG_WARN_CONSTANT_CONVERSION = YES; 436 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 437 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 438 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 439 | CLANG_WARN_EMPTY_BODY = YES; 440 | CLANG_WARN_ENUM_CONVERSION = YES; 441 | CLANG_WARN_INFINITE_RECURSION = YES; 442 | CLANG_WARN_INT_CONVERSION = YES; 443 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 444 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 445 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 446 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 447 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 448 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 449 | CLANG_WARN_STRICT_PROTOTYPES = YES; 450 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 451 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 452 | CLANG_WARN_UNREACHABLE_CODE = YES; 453 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 454 | COPY_PHASE_STRIP = NO; 455 | DEBUG_INFORMATION_FORMAT = dwarf; 456 | ENABLE_STRICT_OBJC_MSGSEND = YES; 457 | ENABLE_TESTABILITY = YES; 458 | GCC_C_LANGUAGE_STANDARD = gnu11; 459 | GCC_DYNAMIC_NO_PIC = NO; 460 | GCC_NO_COMMON_BLOCKS = YES; 461 | GCC_OPTIMIZATION_LEVEL = 0; 462 | GCC_PREPROCESSOR_DEFINITIONS = ( 463 | "DEBUG=1", 464 | "$(inherited)", 465 | ); 466 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 467 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 468 | GCC_WARN_UNDECLARED_SELECTOR = YES; 469 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 470 | GCC_WARN_UNUSED_FUNCTION = YES; 471 | GCC_WARN_UNUSED_VARIABLE = YES; 472 | IPHONEOS_DEPLOYMENT_TARGET = 14.7; 473 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 474 | MTL_FAST_MATH = YES; 475 | ONLY_ACTIVE_ARCH = YES; 476 | SDKROOT = iphoneos; 477 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 478 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 479 | }; 480 | name = Debug; 481 | }; 482 | 55C57B8B27855CD9007D7905 /* Release */ = { 483 | isa = XCBuildConfiguration; 484 | buildSettings = { 485 | ALWAYS_SEARCH_USER_PATHS = NO; 486 | CLANG_ANALYZER_NONNULL = YES; 487 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 488 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 489 | CLANG_CXX_LIBRARY = "libc++"; 490 | CLANG_ENABLE_MODULES = YES; 491 | CLANG_ENABLE_OBJC_ARC = YES; 492 | CLANG_ENABLE_OBJC_WEAK = YES; 493 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 494 | CLANG_WARN_BOOL_CONVERSION = YES; 495 | CLANG_WARN_COMMA = YES; 496 | CLANG_WARN_CONSTANT_CONVERSION = YES; 497 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 498 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 499 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 500 | CLANG_WARN_EMPTY_BODY = YES; 501 | CLANG_WARN_ENUM_CONVERSION = YES; 502 | CLANG_WARN_INFINITE_RECURSION = YES; 503 | CLANG_WARN_INT_CONVERSION = YES; 504 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 505 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 506 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 507 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 508 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 509 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 510 | CLANG_WARN_STRICT_PROTOTYPES = YES; 511 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 512 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 513 | CLANG_WARN_UNREACHABLE_CODE = YES; 514 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 515 | COPY_PHASE_STRIP = NO; 516 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 517 | ENABLE_NS_ASSERTIONS = NO; 518 | ENABLE_STRICT_OBJC_MSGSEND = YES; 519 | GCC_C_LANGUAGE_STANDARD = gnu11; 520 | GCC_NO_COMMON_BLOCKS = YES; 521 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 522 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 523 | GCC_WARN_UNDECLARED_SELECTOR = YES; 524 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 525 | GCC_WARN_UNUSED_FUNCTION = YES; 526 | GCC_WARN_UNUSED_VARIABLE = YES; 527 | IPHONEOS_DEPLOYMENT_TARGET = 14.7; 528 | MTL_ENABLE_DEBUG_INFO = NO; 529 | MTL_FAST_MATH = YES; 530 | SDKROOT = iphoneos; 531 | SWIFT_COMPILATION_MODE = wholemodule; 532 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 533 | VALIDATE_PRODUCT = YES; 534 | }; 535 | name = Release; 536 | }; 537 | 55C57B8D27855CD9007D7905 /* Debug */ = { 538 | isa = XCBuildConfiguration; 539 | buildSettings = { 540 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 541 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 542 | CODE_SIGN_STYLE = Automatic; 543 | CURRENT_PROJECT_VERSION = 1; 544 | DEVELOPMENT_TEAM = 436W326PQC; 545 | GENERATE_INFOPLIST_FILE = YES; 546 | INFOPLIST_FILE = SimpleNavigation/Info.plist; 547 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 548 | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; 549 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 550 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 551 | LD_RUNPATH_SEARCH_PATHS = ( 552 | "$(inherited)", 553 | "@executable_path/Frameworks", 554 | ); 555 | MARKETING_VERSION = 1.0; 556 | PRODUCT_BUNDLE_IDENTIFIER = me.eriklopez.simplenavigation.debug; 557 | PRODUCT_NAME = "$(TARGET_NAME)"; 558 | SWIFT_EMIT_LOC_STRINGS = YES; 559 | SWIFT_VERSION = 5.0; 560 | TARGETED_DEVICE_FAMILY = "1,2"; 561 | }; 562 | name = Debug; 563 | }; 564 | 55C57B8E27855CD9007D7905 /* Release */ = { 565 | isa = XCBuildConfiguration; 566 | buildSettings = { 567 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 568 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 569 | CODE_SIGN_STYLE = Automatic; 570 | CURRENT_PROJECT_VERSION = 1; 571 | DEVELOPMENT_TEAM = 436W326PQC; 572 | GENERATE_INFOPLIST_FILE = YES; 573 | INFOPLIST_FILE = SimpleNavigation/Info.plist; 574 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 575 | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; 576 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 577 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 578 | LD_RUNPATH_SEARCH_PATHS = ( 579 | "$(inherited)", 580 | "@executable_path/Frameworks", 581 | ); 582 | MARKETING_VERSION = 1.0; 583 | PRODUCT_BUNDLE_IDENTIFIER = me.eriklopez.simplenavigation; 584 | PRODUCT_NAME = "$(TARGET_NAME)"; 585 | SWIFT_EMIT_LOC_STRINGS = YES; 586 | SWIFT_VERSION = 5.0; 587 | TARGETED_DEVICE_FAMILY = "1,2"; 588 | }; 589 | name = Release; 590 | }; 591 | /* End XCBuildConfiguration section */ 592 | 593 | /* Begin XCConfigurationList section */ 594 | 55C57B5D27855CD6007D7905 /* Build configuration list for PBXProject "SimpleNavigation" */ = { 595 | isa = XCConfigurationList; 596 | buildConfigurations = ( 597 | 55C57B8A27855CD9007D7905 /* Debug */, 598 | 55C57B8B27855CD9007D7905 /* Release */, 599 | ); 600 | defaultConfigurationIsVisible = 0; 601 | defaultConfigurationName = Release; 602 | }; 603 | 55C57B8C27855CD9007D7905 /* Build configuration list for PBXNativeTarget "SimpleNavigation" */ = { 604 | isa = XCConfigurationList; 605 | buildConfigurations = ( 606 | 55C57B8D27855CD9007D7905 /* Debug */, 607 | 55C57B8E27855CD9007D7905 /* Release */, 608 | ); 609 | defaultConfigurationIsVisible = 0; 610 | defaultConfigurationName = Release; 611 | }; 612 | /* End XCConfigurationList section */ 613 | }; 614 | rootObject = 55C57B5A27855CD6007D7905 /* Project object */; 615 | } 616 | -------------------------------------------------------------------------------- /SimpleNavigation.xcodeproj/xcshareddata/xcschemes/SimpleNavigation.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import UIKit 9 | 10 | @main 11 | class AppDelegate: UIResponder, UIApplicationDelegate { 12 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 13 | return true 14 | } 15 | 16 | // MARK: UISceneSession Lifecycle 17 | 18 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 19 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Navigation/Coordinator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Coordinator.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import SwiftUI 9 | 10 | protocol Coordinator: ObservableObject { 11 | associatedtype NavigationItem: Equatable 12 | 13 | var navigationStack: [(NavigationItem, Any)] { get set } 14 | } 15 | 16 | extension Coordinator { 17 | func isActive(_ item: NavigationItem) -> Binding { 18 | return .constant(navigationStack.contains(where: { $0.0 == item })) 19 | } 20 | 21 | func viewModel(for item: NavigationItem) -> T { 22 | guard let i = navigationStack.first(where: { $0.0 == item }) else { 23 | fatalError("Item not in stack.") 24 | } 25 | guard let vm = i.1 as? T else { 26 | fatalError("View model type is not correct.") 27 | } 28 | return vm 29 | } 30 | 31 | func pushToNavigationStack(_ item: NavigationItem, viewModel: Any) { 32 | navigationStack.append((item, viewModel)) 33 | } 34 | 35 | func popFromNavigationStack() { 36 | navigationStack.removeLast() 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Navigation/Navigable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Navigable.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/11. 6 | // 7 | 8 | import Foundation 9 | 10 | protocol Navigable { 11 | associatedtype NavigationItem: Equatable 12 | 13 | var onNavigation: ((NavigationItem) -> Void)! { get } 14 | } 15 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Account/AccountCoordinator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AccountCoordinator.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import Foundation 9 | 10 | enum AccountCoordinatorNavigation { 11 | case account 12 | case accountEdit 13 | case accountConfirm 14 | case itemCoordinator 15 | } 16 | 17 | final class AccountCoordinator: Coordinator { 18 | @Published var navigationStack: [(AccountCoordinatorNavigation, Any)] = [] 19 | 20 | init() { 21 | let viewModel = AccountViewModel() 22 | viewModel.onNavigation = { [weak self] navigation in 23 | switch navigation { 24 | case .selectItem(let itemId): 25 | self?.pushItemCoordinator(itemId) 26 | case .edit: 27 | self?.pushAccountEditView() 28 | } 29 | } 30 | pushToNavigationStack(.account, viewModel: viewModel) 31 | } 32 | 33 | private func pushAccountEditView() { 34 | let viewModel = AccountEditViewModel() 35 | viewModel.onNavigation = { [weak self] navigation in 36 | switch navigation { 37 | case .cancel: 38 | self?.popFromNavigationStack() 39 | case let .confirm(name, username): 40 | self?.pushAccountConfirmView(name: name, username: username) 41 | } 42 | } 43 | pushToNavigationStack(.accountEdit, viewModel: viewModel) 44 | } 45 | 46 | private func pushAccountConfirmView(name: String, username: String) { 47 | let viewModel = AccountConfirmViewModel(name: name, username: username) 48 | viewModel.onNavigation = { [weak self] navigation in 49 | switch navigation { 50 | case .back: 51 | self?.popFromNavigationStack() 52 | case .complete: 53 | // Pop twice 54 | self?.popFromNavigationStack() 55 | self?.popFromNavigationStack() 56 | } 57 | } 58 | pushToNavigationStack(.accountConfirm, viewModel: viewModel) 59 | } 60 | 61 | private func pushItemCoordinator(_ itemId: ItemId) { 62 | let coordinator = ItemCoordinator(itemId: itemId) 63 | coordinator.onFinish = { [weak self] in 64 | self?.popFromNavigationStack() 65 | } 66 | pushToNavigationStack(.itemCoordinator, viewModel: coordinator) 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Account/AccountCoordinatorView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AccountCoordinatorView.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct AccountCoordinatorView: View { 11 | @ObservedObject var coordinator: AccountCoordinator 12 | 13 | var body: some View { 14 | ZStack { 15 | AccountView(viewModel: coordinator.viewModel(for: .account)) 16 | LazyNavigationLink( 17 | isActive: coordinator.isActive(.accountEdit), 18 | destination: { 19 | AccountEditView(viewModel: coordinator.viewModel(for: .accountEdit)) 20 | LazyNavigationLink( 21 | isActive: coordinator.isActive(.accountConfirm), 22 | destination: { 23 | AccountConfirmView(viewModel: coordinator.viewModel(for: .accountConfirm)) 24 | }) 25 | }) 26 | LazyNavigationLink( 27 | isActive: coordinator.isActive(.itemCoordinator), 28 | destination: { 29 | ItemCoordinatorView(coordinator: coordinator.viewModel(for: .itemCoordinator)) 30 | }) 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Account/ViewModels/AccountConfirmViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AccountConfirmViewModel.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/11. 6 | // 7 | 8 | import Foundation 9 | 10 | enum AccountConfirmNavigation { 11 | case back 12 | case complete 13 | } 14 | 15 | final class AccountConfirmViewModel: ObservableObject, Navigable { 16 | let name: String 17 | let username: String 18 | var onNavigation: ((AccountConfirmNavigation) -> Void)! 19 | 20 | init(name: String, username: String) { 21 | self.name = name 22 | self.username = username 23 | } 24 | 25 | func back() { 26 | onNavigation(.back) 27 | } 28 | 29 | func complete() { 30 | onNavigation(.complete) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Account/ViewModels/AccountEditViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AccountEditViewModel.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/11. 6 | // 7 | 8 | import Foundation 9 | 10 | enum AccountEditNavigation: Equatable { 11 | case cancel 12 | case confirm(name: String, username: String) 13 | } 14 | 15 | final class AccountEditViewModel: ObservableObject, Navigable { 16 | @Published var name: String = "" 17 | @Published var username: String = "" 18 | 19 | var onNavigation: ((AccountEditNavigation) -> Void)! 20 | 21 | func cancel() { 22 | onNavigation(.cancel) 23 | } 24 | 25 | func confirm() { 26 | onNavigation(.confirm(name: name, username: username)) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Account/ViewModels/AccountViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AccountViewModel.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/11. 6 | // 7 | 8 | import Combine 9 | 10 | enum AccountNavigation: Equatable { 11 | case selectItem(ItemId) 12 | case edit 13 | } 14 | 15 | final class AccountViewModel: ObservableObject, Navigable { 16 | let name: String = "Name" 17 | let username: String = "@name" 18 | var onNavigation: ((AccountNavigation) -> Void)! 19 | 20 | func selectItem(_ itemId: ItemId) { 21 | onNavigation(.selectItem(itemId)) 22 | } 23 | 24 | func edit() { 25 | onNavigation(.edit) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Account/Views/AccountConfirmView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AccountConfirmView.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/11. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct AccountConfirmView: View { 11 | @ObservedObject var viewModel: AccountConfirmViewModel 12 | 13 | var body: some View { 14 | Form { 15 | Text(viewModel.name) 16 | Text(viewModel.username) 17 | } 18 | .navigationTitle("account.confirm.title") 19 | .navigationBarTitleDisplayMode(.inline) 20 | .navigationBarBackButtonHidden(true) 21 | .toolbar { 22 | ToolbarItem(placement: .navigationBarLeading, content: { 23 | Button(action: viewModel.back) { 24 | Image(systemName: "chevron.backward") 25 | } 26 | }) 27 | ToolbarItem(placement: .navigationBarTrailing, content: { 28 | Button(action: viewModel.complete) { 29 | Text("account.confirm.complete") 30 | } 31 | }) 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Account/Views/AccountEditView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AccountEditView.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/11. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct AccountEditView: View { 11 | @ObservedObject var viewModel: AccountEditViewModel 12 | 13 | var body: some View { 14 | Form { 15 | TextField(LocalizedStringKey("account.edit.name"), text: $viewModel.name) 16 | TextField(LocalizedStringKey("account.edit.username"), text: $viewModel.username) 17 | } 18 | .navigationTitle("account.edit.title") 19 | .navigationBarTitleDisplayMode(.inline) 20 | .navigationBarBackButtonHidden(true) 21 | .toolbar { 22 | ToolbarItem(placement: .navigationBarLeading, content: { 23 | Button(action: viewModel.cancel) { 24 | Image(systemName: "chevron.backward") 25 | } 26 | }) 27 | ToolbarItem(placement: .navigationBarTrailing, content: { 28 | Button(action: viewModel.confirm) { 29 | Text("account.edit.confirm") 30 | } 31 | }) 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Account/Views/AccountView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AccountView.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct AccountView: View { 11 | @ObservedObject var viewModel: AccountViewModel 12 | 13 | var body: some View { 14 | Form { 15 | Section(content: { 16 | HStack { 17 | Circle() 18 | .fill(Color.gray) 19 | .frame(width: 100, height: 100) 20 | VStack(alignment: .leading) { 21 | Text(viewModel.name) 22 | .font(.headline) 23 | Text(viewModel.username) 24 | .font(.subheadline) 25 | Button("Edit", action: viewModel.edit) 26 | } 27 | } 28 | }, header: { 29 | Text("account.header.default") 30 | }) 31 | Section(content: { 32 | Button(action: { 33 | viewModel.selectItem("Item One") 34 | }, label: { 35 | Text("Item One") 36 | }) 37 | Button(action: { 38 | viewModel.selectItem("Item Two") 39 | }, label: { 40 | Text("Item Two") 41 | }) 42 | }, header: { 43 | Text("account.header.favorites") 44 | }) 45 | } 46 | .navigationBarHidden(true) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/AppCoordinator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppCoordinator.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/06. 6 | // 7 | 8 | import Foundation 9 | 10 | enum AppCoordinatorNavigation { 11 | case homeFeedCoordinator 12 | case musicFeedCoordinator 13 | case accountCoordinator 14 | } 15 | 16 | final class AppCoordinator: Coordinator { 17 | @Published var navigationStack: [(AppCoordinatorNavigation, Any)] = [] 18 | 19 | init() { 20 | pushToNavigationStack(.homeFeedCoordinator, viewModel: FeedCoordinator(feed: .home)) 21 | pushToNavigationStack(.musicFeedCoordinator, viewModel: FeedCoordinator(feed: .music)) 22 | pushToNavigationStack(.accountCoordinator, viewModel: AccountCoordinator()) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/AppCoordinatorView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppCoordinatorView.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct AppCoordinatorView: View { 11 | @ObservedObject var coordinator: AppCoordinator 12 | 13 | var body: some View { 14 | TabView { 15 | NavigationView { 16 | FeedCoordinatorView(coordinator: coordinator.viewModel(for: .homeFeedCoordinator)) 17 | } 18 | .tabItem { 19 | Label("app.tab.feed", systemImage: "house") 20 | } 21 | .navigationViewStyle(.stack) 22 | NavigationView { 23 | FeedCoordinatorView(coordinator: coordinator.viewModel(for: .musicFeedCoordinator)) 24 | } 25 | .tabItem { 26 | Label("app.tab.music", systemImage: "music.note.list") 27 | } 28 | .navigationViewStyle(.stack) 29 | NavigationView { 30 | AccountCoordinatorView(coordinator: coordinator.viewModel(for: .accountCoordinator)) 31 | } 32 | .tabItem { 33 | Label("app.tab.account", systemImage: "person") 34 | } 35 | .navigationViewStyle(.stack) 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Feed/FeedCoordinator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FeedCoordinator.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import Foundation 9 | 10 | enum FeedCoordinatorNavigation { 11 | case feed 12 | case item 13 | } 14 | 15 | final class FeedCoordinator: Coordinator { 16 | @Published var navigationStack: [(FeedCoordinatorNavigation, Any)] = [] 17 | 18 | init(feed: Feed) { 19 | let viewModel = FeedViewModel(feed: feed) 20 | viewModel.onNavigation = { [weak self] navigation in 21 | switch navigation { 22 | case .selectItem(let itemId): 23 | self?.pushItemCoordinator(itemId) 24 | } 25 | } 26 | pushToNavigationStack(.feed, viewModel: viewModel) 27 | } 28 | 29 | private func pushItemCoordinator(_ itemId: ItemId) { 30 | let coordinator = ItemCoordinator(itemId: itemId) 31 | coordinator.onFinish = { [weak self] in 32 | self?.popFromNavigationStack() 33 | } 34 | pushToNavigationStack(.item, viewModel: coordinator) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Feed/FeedCoordinatorView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FeedCoordinatorView.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct FeedCoordinatorView: View { 11 | @ObservedObject var coordinator: FeedCoordinator 12 | 13 | var body: some View { 14 | ZStack { 15 | FeedView(viewModel: coordinator.viewModel(for: .feed)) 16 | LazyNavigationLink( 17 | isActive: coordinator.isActive(.item), 18 | destination: { 19 | ItemCoordinatorView(coordinator: coordinator.viewModel(for: .item)) 20 | }) 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Feed/ViewModels/FeedViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FeedViewModel.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import Foundation 9 | 10 | enum FeedNavigation: Equatable { 11 | case selectItem(ItemId) 12 | } 13 | 14 | final class FeedViewModel: ObservableObject, Navigable { 15 | lazy var data: [String] = { 16 | switch feed { 17 | case .home: 18 | return [ 19 | "Item One", 20 | "Item Two", 21 | "Item Three", 22 | "Item Four", 23 | "Item Five", 24 | "Item Six" 25 | ] 26 | case .music: 27 | return [ 28 | "Track One", 29 | "Track Two", 30 | "Track Three" 31 | ] 32 | } 33 | }() 34 | 35 | var title: String { 36 | return feed.rawValue 37 | } 38 | 39 | var onNavigation: ((FeedNavigation) -> Void)! 40 | 41 | private let feed: Feed 42 | 43 | init(feed: Feed) { 44 | self.feed = feed 45 | } 46 | 47 | func showItem(_ itemId: ItemId) { 48 | onNavigation(.selectItem(itemId)) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Feed/Views/FeedItemView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FeedItemView.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct FeedItemView: View { 11 | let title: String 12 | 13 | var body: some View { 14 | VStack(alignment: .leading) { 15 | HStack { 16 | Image(systemName: "circle.dashed") 17 | .resizable() 18 | .scaledToFit() 19 | .frame(maxWidth: 30) 20 | VStack(alignment: .leading) { 21 | Text(title) 22 | .font(.headline) 23 | Text(title) 24 | .font(.subheadline) 25 | } 26 | } 27 | .padding(5) 28 | Rectangle() 29 | .fill(Color.gray) 30 | .frame(height: 250) 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Feed/Views/FeedView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FeedView.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct FeedView: View { 11 | @ObservedObject var viewModel: FeedViewModel 12 | 13 | private let columns: [GridItem] = [.init(.flexible())] 14 | 15 | var body: some View { 16 | ScrollView { 17 | LazyVGrid(columns: columns) { 18 | ForEach(viewModel.data, id: \.self) { itemId in 19 | FeedItemView(title: itemId) 20 | .padding(.bottom) 21 | .onTapGesture { 22 | viewModel.showItem(itemId) 23 | } 24 | } 25 | } 26 | } 27 | .navigationTitle("\(viewModel.title)") 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Item/ItemCoordinator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ItemCoordinator.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import Foundation 9 | 10 | enum ItemCoordinatorNavigation { 11 | case item 12 | case details 13 | } 14 | 15 | final class ItemCoordinator: Coordinator { 16 | @Published var navigationStack: [(ItemCoordinatorNavigation, Any)] = [] 17 | 18 | var onFinish: (() -> Void)! 19 | 20 | init(itemId: ItemId) { 21 | let viewModel = ItemViewModel(itemId: itemId) 22 | viewModel.onNavigation = { [weak self] navigation in 23 | switch navigation { 24 | case .back: 25 | self?.onFinish() 26 | case .more: 27 | self?.pushItemDetails() 28 | } 29 | } 30 | pushToNavigationStack(.item, viewModel: viewModel) 31 | } 32 | 33 | func popItemDetails() { 34 | popFromNavigationStack() 35 | } 36 | 37 | private func pushItemDetails() { 38 | let viewModel = ItemDetailsViewModel() 39 | pushToNavigationStack(.details, viewModel: viewModel) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Item/ItemCoordinatorView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ItemCoordinatorView.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ItemCoordinatorView: View { 11 | @ObservedObject var coordinator: ItemCoordinator 12 | 13 | var body: some View { 14 | Group { 15 | ItemView(viewModel: coordinator.viewModel(for: .item)) 16 | } 17 | .sheet( 18 | isPresented: coordinator.isActive(.details), 19 | onDismiss: { 20 | coordinator.popItemDetails() 21 | }, 22 | content: { 23 | ItemDetailsView(viewModel: coordinator.viewModel(for: .details)) 24 | }) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Item/ViewModels/ItemDetailsViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ItemDetailsViewModel.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/11. 6 | // 7 | 8 | import Foundation 9 | 10 | final class ItemDetailsViewModel: ObservableObject { 11 | let details = "Swipe down to close." 12 | } 13 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Item/ViewModels/ItemViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ItemViewModel.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import Foundation 9 | 10 | enum ItemNavigation { 11 | case back 12 | case more 13 | } 14 | 15 | final class ItemViewModel: ObservableObject, Navigable { 16 | let itemName: String 17 | let itemDescription = "A view that pads this view inside the specified edge insets with a system-calculated amount of padding." 18 | var onNavigation: ((ItemNavigation) -> Void)! 19 | 20 | init(itemId: ItemId) { 21 | itemName = "\(itemId)" 22 | } 23 | 24 | func back() { 25 | onNavigation(.back) 26 | } 27 | 28 | func more() { 29 | onNavigation(.more) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Item/Views/ItemDetailsView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ItemDetailsView.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/11. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ItemDetailsView: View { 11 | @ObservedObject var viewModel: ItemDetailsViewModel 12 | 13 | var body: some View { 14 | Text(viewModel.details) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Item/Views/ItemView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ItemView.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ItemView: View { 11 | @ObservedObject var viewModel: ItemViewModel 12 | 13 | var body: some View { 14 | VStack(alignment: .leading) { 15 | Rectangle() 16 | .fill(Color.gray) 17 | .frame(height: 400) 18 | Group { 19 | Text(viewModel.itemDescription) 20 | Button("item.more", action: viewModel.more) 21 | } 22 | .padding() 23 | Spacer() 24 | } 25 | .navigationTitle(viewModel.itemName) 26 | .navigationBarTitleDisplayMode(.inline) 27 | .navigationBarBackButtonHidden(true) 28 | .toolbar { 29 | ToolbarItem(placement: .navigationBarLeading, content: { 30 | Button(action: viewModel.back) { 31 | Image(systemName: "chevron.backward") 32 | } 33 | }) 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/Screens/Launch/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/SharedViews/LazyLoadView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LazyLoadView.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct LazyLoadView: View { 11 | private let build: () -> Content 12 | 13 | init(_ build: @autoclosure @escaping () -> Content) { 14 | self.build = build 15 | } 16 | 17 | var body: Content { 18 | build() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/Content/SharedViews/LazyNavigationLink.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LazyNavigationLink.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/12. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct LazyNavigationLink: View where Destination: View { 11 | let isActive: Binding 12 | @ViewBuilder let destination: () -> Destination 13 | 14 | var body: some View { 15 | NavigationLink( 16 | isActive: isActive, 17 | destination: { 18 | LazyLoadView(destination()) 19 | }, 20 | label: { 21 | EmptyView() 22 | }) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SimpleNavigation/Application/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/05. 6 | // 7 | 8 | import SwiftUI 9 | 10 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 11 | var window: UIWindow? 12 | 13 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 14 | window = (scene as? UIWindowScene).map(UIWindow.init(windowScene:)) 15 | window?.rootViewController = UIHostingController(rootView: AppCoordinatorView(coordinator: AppCoordinator())) 16 | window?.makeKeyAndVisible() 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /SimpleNavigation/Entities/Feed.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Feed.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/11. 6 | // 7 | 8 | import Foundation 9 | 10 | enum Feed: String { 11 | case home = "Feed" 12 | case music = "Music" 13 | } 14 | -------------------------------------------------------------------------------- /SimpleNavigation/Entities/ItemId.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ItemId.swift 3 | // SimpleNavigation 4 | // 5 | // Created by Erik Lopez on 2022/01/11. 6 | // 7 | 8 | import Foundation 9 | 10 | typealias ItemId = String 11 | -------------------------------------------------------------------------------- /SimpleNavigation/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIApplicationSceneManifest 6 | 7 | UIApplicationSupportsMultipleScenes 8 | 9 | UISceneConfigurations 10 | 11 | UIWindowSceneSessionRoleApplication 12 | 13 | 14 | UISceneConfigurationName 15 | Default Configuration 16 | UISceneDelegateClassName 17 | $(PRODUCT_MODULE_NAME).SceneDelegate 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /SimpleNavigation/Resources/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /SimpleNavigation/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /SimpleNavigation/Resources/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /SimpleNavigation/Resources/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | SimpleNavigation 4 | 5 | Created by Erik Lopez on 2022/01/12. 6 | 7 | */ 8 | "app.tab.feed" = "Feed"; 9 | "app.tab.music" = "Music"; 10 | "app.tab.account" = "Account"; 11 | 12 | "account.edit.title" = "Edit Account"; 13 | "account.edit.name" = "Name"; 14 | "account.edit.username" = "Username"; 15 | "account.edit.confirm" = "Confirm"; 16 | 17 | "account.confirm.title" = "Confirm Changes"; 18 | "account.confirm.complete" = "Complete"; 19 | 20 | "account.header.default" = "Account"; 21 | "account.header.favorites" = "Favorites"; 22 | 23 | "item.more" = "More"; 24 | --------------------------------------------------------------------------------