├── .gitignore ├── DeeplinkingWithChainPattern.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── xcshareddata │ └── xcschemes │ │ └── DeeplinkingWithChainPattern.xcscheme └── xcuserdata │ └── ahmetkeskin.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── DeeplinkingWithChainPattern ├── AppDelegate.swift ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Deeplink │ ├── DeeplinkManager.swift │ ├── DeeplinkableItem.swift │ └── Items │ │ ├── OrderDetailDeeplinkItem.swift │ │ └── ProductDetailDeeplinkItem.swift ├── Info.plist ├── SceneDelegate.swift ├── ViewControllers │ ├── HomepageViewController.swift │ ├── OrderDetailViewController.swift │ └── ProductDetailViewController.swift └── deeplink.gif ├── DeeplinkingWithChainPatternTests ├── Info.plist ├── OrderDetailDeeplinkItemTests.swift └── ProductDetailDeeplinkItemTests.swift └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | *.xcuserstate 8 | *.xcbkptlist 9 | *.xcexplist 10 | 11 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 12 | *.xcscmblueprint 13 | *.xccheckout 14 | 15 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 16 | build/ 17 | DerivedData/ 18 | *.moved-aside 19 | *.pbxuser 20 | !default.pbxuser 21 | *.mode1v3 22 | !default.mode1v3 23 | *.mode2v3 24 | !default.mode2v3 25 | *.perspectivev3 26 | !default.perspectivev3 27 | 28 | #CocoaPods 29 | Pods 30 | 31 | ## Obj-C/Swift specific 32 | *.hmap 33 | 34 | ## App packaging 35 | *.ipa 36 | *.dSYM.zip 37 | *.dSYM 38 | 39 | ## Playgrounds 40 | timeline.xctimeline 41 | playground.xcworkspace 42 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 591B682C25E29AC50003410A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 591B682B25E29AC50003410A /* AppDelegate.swift */; }; 11 | 591B682E25E29AC50003410A /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 591B682D25E29AC50003410A /* SceneDelegate.swift */; }; 12 | 591B683325E29AC50003410A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 591B683125E29AC50003410A /* Main.storyboard */; }; 13 | 591B683525E29AC50003410A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 591B683425E29AC50003410A /* Assets.xcassets */; }; 14 | 591B683825E29AC50003410A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 591B683625E29AC50003410A /* LaunchScreen.storyboard */; }; 15 | 591B686425E29FF70003410A /* ProductDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 591B686325E29FF70003410A /* ProductDetailViewController.swift */; }; 16 | 591B686925E2A0140003410A /* OrderDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 591B686825E2A0140003410A /* OrderDetailViewController.swift */; }; 17 | 591B686E25E2A0CF0003410A /* HomepageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 591B686D25E2A0CF0003410A /* HomepageViewController.swift */; }; 18 | 591B687625E2A2AF0003410A /* DeeplinkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 591B687525E2A2AF0003410A /* DeeplinkManager.swift */; }; 19 | 591B687C25E2A2E80003410A /* DeeplinkableItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 591B687B25E2A2E80003410A /* DeeplinkableItem.swift */; }; 20 | 591B688425E2A40F0003410A /* ProductDetailDeeplinkItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 591B688325E2A40F0003410A /* ProductDetailDeeplinkItem.swift */; }; 21 | 591B688C25E2A65A0003410A /* OrderDetailDeeplinkItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 591B688B25E2A65A0003410A /* OrderDetailDeeplinkItem.swift */; }; 22 | 591B689125E4322D0003410A /* ProductDetailDeeplinkItemTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 591B689025E4322D0003410A /* ProductDetailDeeplinkItemTests.swift */; }; 23 | 591B689C25E437B00003410A /* OrderDetailDeeplinkItemTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 591B689B25E437B00003410A /* OrderDetailDeeplinkItemTests.swift */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | 591B683F25E29AC60003410A /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = 591B682025E29AC50003410A /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = 591B682725E29AC50003410A; 32 | remoteInfo = DeeplinkingWithChainPattern; 33 | }; 34 | /* End PBXContainerItemProxy section */ 35 | 36 | /* Begin PBXFileReference section */ 37 | 591B682825E29AC50003410A /* DeeplinkingWithChainPattern.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DeeplinkingWithChainPattern.app; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | 591B682B25E29AC50003410A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 39 | 591B682D25E29AC50003410A /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 40 | 591B683225E29AC50003410A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | 591B683425E29AC50003410A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 42 | 591B683725E29AC50003410A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 43 | 591B683925E29AC50003410A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | 591B683E25E29AC60003410A /* DeeplinkingWithChainPatternTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DeeplinkingWithChainPatternTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 591B684425E29AC60003410A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | 591B686325E29FF70003410A /* ProductDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductDetailViewController.swift; sourceTree = ""; }; 47 | 591B686825E2A0140003410A /* OrderDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderDetailViewController.swift; sourceTree = ""; }; 48 | 591B686D25E2A0CF0003410A /* HomepageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomepageViewController.swift; sourceTree = ""; }; 49 | 591B687525E2A2AF0003410A /* DeeplinkManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeeplinkManager.swift; sourceTree = ""; }; 50 | 591B687B25E2A2E80003410A /* DeeplinkableItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeeplinkableItem.swift; sourceTree = ""; }; 51 | 591B688325E2A40F0003410A /* ProductDetailDeeplinkItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductDetailDeeplinkItem.swift; sourceTree = ""; }; 52 | 591B688B25E2A65A0003410A /* OrderDetailDeeplinkItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderDetailDeeplinkItem.swift; sourceTree = ""; }; 53 | 591B689025E4322D0003410A /* ProductDetailDeeplinkItemTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductDetailDeeplinkItemTests.swift; sourceTree = ""; }; 54 | 591B689B25E437B00003410A /* OrderDetailDeeplinkItemTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderDetailDeeplinkItemTests.swift; sourceTree = ""; }; 55 | /* End PBXFileReference section */ 56 | 57 | /* Begin PBXFrameworksBuildPhase section */ 58 | 591B682525E29AC50003410A /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | 591B683B25E29AC60003410A /* Frameworks */ = { 66 | isa = PBXFrameworksBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | /* End PBXFrameworksBuildPhase section */ 73 | 74 | /* Begin PBXGroup section */ 75 | 591B681F25E29AC50003410A = { 76 | isa = PBXGroup; 77 | children = ( 78 | 591B682A25E29AC50003410A /* DeeplinkingWithChainPattern */, 79 | 591B684125E29AC60003410A /* DeeplinkingWithChainPatternTests */, 80 | 591B682925E29AC50003410A /* Products */, 81 | ); 82 | sourceTree = ""; 83 | }; 84 | 591B682925E29AC50003410A /* Products */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 591B682825E29AC50003410A /* DeeplinkingWithChainPattern.app */, 88 | 591B683E25E29AC60003410A /* DeeplinkingWithChainPatternTests.xctest */, 89 | ); 90 | name = Products; 91 | sourceTree = ""; 92 | }; 93 | 591B682A25E29AC50003410A /* DeeplinkingWithChainPattern */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 591B685F25E29FAC0003410A /* Deeplink */, 97 | 591B685E25E29FA50003410A /* ViewControllers */, 98 | 591B682B25E29AC50003410A /* AppDelegate.swift */, 99 | 591B682D25E29AC50003410A /* SceneDelegate.swift */, 100 | 591B683125E29AC50003410A /* Main.storyboard */, 101 | 591B683425E29AC50003410A /* Assets.xcassets */, 102 | 591B683625E29AC50003410A /* LaunchScreen.storyboard */, 103 | 591B683925E29AC50003410A /* Info.plist */, 104 | ); 105 | path = DeeplinkingWithChainPattern; 106 | sourceTree = ""; 107 | }; 108 | 591B684125E29AC60003410A /* DeeplinkingWithChainPatternTests */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 591B689025E4322D0003410A /* ProductDetailDeeplinkItemTests.swift */, 112 | 591B689B25E437B00003410A /* OrderDetailDeeplinkItemTests.swift */, 113 | 591B684425E29AC60003410A /* Info.plist */, 114 | ); 115 | path = DeeplinkingWithChainPatternTests; 116 | sourceTree = ""; 117 | }; 118 | 591B685E25E29FA50003410A /* ViewControllers */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 591B686D25E2A0CF0003410A /* HomepageViewController.swift */, 122 | 591B686325E29FF70003410A /* ProductDetailViewController.swift */, 123 | 591B686825E2A0140003410A /* OrderDetailViewController.swift */, 124 | ); 125 | path = ViewControllers; 126 | sourceTree = ""; 127 | }; 128 | 591B685F25E29FAC0003410A /* Deeplink */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | 591B687A25E2A2BF0003410A /* Items */, 132 | 591B687525E2A2AF0003410A /* DeeplinkManager.swift */, 133 | 591B687B25E2A2E80003410A /* DeeplinkableItem.swift */, 134 | ); 135 | path = Deeplink; 136 | sourceTree = ""; 137 | }; 138 | 591B687A25E2A2BF0003410A /* Items */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 591B688325E2A40F0003410A /* ProductDetailDeeplinkItem.swift */, 142 | 591B688B25E2A65A0003410A /* OrderDetailDeeplinkItem.swift */, 143 | ); 144 | path = Items; 145 | sourceTree = ""; 146 | }; 147 | /* End PBXGroup section */ 148 | 149 | /* Begin PBXNativeTarget section */ 150 | 591B682725E29AC50003410A /* DeeplinkingWithChainPattern */ = { 151 | isa = PBXNativeTarget; 152 | buildConfigurationList = 591B685225E29AC60003410A /* Build configuration list for PBXNativeTarget "DeeplinkingWithChainPattern" */; 153 | buildPhases = ( 154 | 591B682425E29AC50003410A /* Sources */, 155 | 591B682525E29AC50003410A /* Frameworks */, 156 | 591B682625E29AC50003410A /* Resources */, 157 | ); 158 | buildRules = ( 159 | ); 160 | dependencies = ( 161 | ); 162 | name = DeeplinkingWithChainPattern; 163 | productName = DeeplinkingWithChainPattern; 164 | productReference = 591B682825E29AC50003410A /* DeeplinkingWithChainPattern.app */; 165 | productType = "com.apple.product-type.application"; 166 | }; 167 | 591B683D25E29AC60003410A /* DeeplinkingWithChainPatternTests */ = { 168 | isa = PBXNativeTarget; 169 | buildConfigurationList = 591B685525E29AC60003410A /* Build configuration list for PBXNativeTarget "DeeplinkingWithChainPatternTests" */; 170 | buildPhases = ( 171 | 591B683A25E29AC60003410A /* Sources */, 172 | 591B683B25E29AC60003410A /* Frameworks */, 173 | 591B683C25E29AC60003410A /* Resources */, 174 | ); 175 | buildRules = ( 176 | ); 177 | dependencies = ( 178 | 591B684025E29AC60003410A /* PBXTargetDependency */, 179 | ); 180 | name = DeeplinkingWithChainPatternTests; 181 | productName = DeeplinkingWithChainPatternTests; 182 | productReference = 591B683E25E29AC60003410A /* DeeplinkingWithChainPatternTests.xctest */; 183 | productType = "com.apple.product-type.bundle.unit-test"; 184 | }; 185 | /* End PBXNativeTarget section */ 186 | 187 | /* Begin PBXProject section */ 188 | 591B682025E29AC50003410A /* Project object */ = { 189 | isa = PBXProject; 190 | attributes = { 191 | LastSwiftUpdateCheck = 1220; 192 | LastUpgradeCheck = 1220; 193 | TargetAttributes = { 194 | 591B682725E29AC50003410A = { 195 | CreatedOnToolsVersion = 12.2; 196 | }; 197 | 591B683D25E29AC60003410A = { 198 | CreatedOnToolsVersion = 12.2; 199 | TestTargetID = 591B682725E29AC50003410A; 200 | }; 201 | }; 202 | }; 203 | buildConfigurationList = 591B682325E29AC50003410A /* Build configuration list for PBXProject "DeeplinkingWithChainPattern" */; 204 | compatibilityVersion = "Xcode 9.3"; 205 | developmentRegion = en; 206 | hasScannedForEncodings = 0; 207 | knownRegions = ( 208 | en, 209 | Base, 210 | ); 211 | mainGroup = 591B681F25E29AC50003410A; 212 | productRefGroup = 591B682925E29AC50003410A /* Products */; 213 | projectDirPath = ""; 214 | projectRoot = ""; 215 | targets = ( 216 | 591B682725E29AC50003410A /* DeeplinkingWithChainPattern */, 217 | 591B683D25E29AC60003410A /* DeeplinkingWithChainPatternTests */, 218 | ); 219 | }; 220 | /* End PBXProject section */ 221 | 222 | /* Begin PBXResourcesBuildPhase section */ 223 | 591B682625E29AC50003410A /* Resources */ = { 224 | isa = PBXResourcesBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | 591B683825E29AC50003410A /* LaunchScreen.storyboard in Resources */, 228 | 591B683525E29AC50003410A /* Assets.xcassets in Resources */, 229 | 591B683325E29AC50003410A /* Main.storyboard in Resources */, 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | }; 233 | 591B683C25E29AC60003410A /* Resources */ = { 234 | isa = PBXResourcesBuildPhase; 235 | buildActionMask = 2147483647; 236 | files = ( 237 | ); 238 | runOnlyForDeploymentPostprocessing = 0; 239 | }; 240 | /* End PBXResourcesBuildPhase section */ 241 | 242 | /* Begin PBXSourcesBuildPhase section */ 243 | 591B682425E29AC50003410A /* Sources */ = { 244 | isa = PBXSourcesBuildPhase; 245 | buildActionMask = 2147483647; 246 | files = ( 247 | 591B686925E2A0140003410A /* OrderDetailViewController.swift in Sources */, 248 | 591B688425E2A40F0003410A /* ProductDetailDeeplinkItem.swift in Sources */, 249 | 591B682C25E29AC50003410A /* AppDelegate.swift in Sources */, 250 | 591B682E25E29AC50003410A /* SceneDelegate.swift in Sources */, 251 | 591B687625E2A2AF0003410A /* DeeplinkManager.swift in Sources */, 252 | 591B688C25E2A65A0003410A /* OrderDetailDeeplinkItem.swift in Sources */, 253 | 591B686425E29FF70003410A /* ProductDetailViewController.swift in Sources */, 254 | 591B686E25E2A0CF0003410A /* HomepageViewController.swift in Sources */, 255 | 591B687C25E2A2E80003410A /* DeeplinkableItem.swift in Sources */, 256 | ); 257 | runOnlyForDeploymentPostprocessing = 0; 258 | }; 259 | 591B683A25E29AC60003410A /* Sources */ = { 260 | isa = PBXSourcesBuildPhase; 261 | buildActionMask = 2147483647; 262 | files = ( 263 | 591B689C25E437B00003410A /* OrderDetailDeeplinkItemTests.swift in Sources */, 264 | 591B689125E4322D0003410A /* ProductDetailDeeplinkItemTests.swift in Sources */, 265 | ); 266 | runOnlyForDeploymentPostprocessing = 0; 267 | }; 268 | /* End PBXSourcesBuildPhase section */ 269 | 270 | /* Begin PBXTargetDependency section */ 271 | 591B684025E29AC60003410A /* PBXTargetDependency */ = { 272 | isa = PBXTargetDependency; 273 | target = 591B682725E29AC50003410A /* DeeplinkingWithChainPattern */; 274 | targetProxy = 591B683F25E29AC60003410A /* PBXContainerItemProxy */; 275 | }; 276 | /* End PBXTargetDependency section */ 277 | 278 | /* Begin PBXVariantGroup section */ 279 | 591B683125E29AC50003410A /* Main.storyboard */ = { 280 | isa = PBXVariantGroup; 281 | children = ( 282 | 591B683225E29AC50003410A /* Base */, 283 | ); 284 | name = Main.storyboard; 285 | sourceTree = ""; 286 | }; 287 | 591B683625E29AC50003410A /* LaunchScreen.storyboard */ = { 288 | isa = PBXVariantGroup; 289 | children = ( 290 | 591B683725E29AC50003410A /* Base */, 291 | ); 292 | name = LaunchScreen.storyboard; 293 | sourceTree = ""; 294 | }; 295 | /* End PBXVariantGroup section */ 296 | 297 | /* Begin XCBuildConfiguration section */ 298 | 591B685025E29AC60003410A /* Debug */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | ALWAYS_SEARCH_USER_PATHS = NO; 302 | CLANG_ANALYZER_NONNULL = YES; 303 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 304 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 305 | CLANG_CXX_LIBRARY = "libc++"; 306 | CLANG_ENABLE_MODULES = YES; 307 | CLANG_ENABLE_OBJC_ARC = YES; 308 | CLANG_ENABLE_OBJC_WEAK = YES; 309 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 310 | CLANG_WARN_BOOL_CONVERSION = YES; 311 | CLANG_WARN_COMMA = YES; 312 | CLANG_WARN_CONSTANT_CONVERSION = YES; 313 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 314 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 315 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 316 | CLANG_WARN_EMPTY_BODY = YES; 317 | CLANG_WARN_ENUM_CONVERSION = YES; 318 | CLANG_WARN_INFINITE_RECURSION = YES; 319 | CLANG_WARN_INT_CONVERSION = YES; 320 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 321 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 322 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 323 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 324 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 325 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 326 | CLANG_WARN_STRICT_PROTOTYPES = YES; 327 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 328 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 329 | CLANG_WARN_UNREACHABLE_CODE = YES; 330 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 331 | COPY_PHASE_STRIP = NO; 332 | DEBUG_INFORMATION_FORMAT = dwarf; 333 | ENABLE_STRICT_OBJC_MSGSEND = YES; 334 | ENABLE_TESTABILITY = YES; 335 | GCC_C_LANGUAGE_STANDARD = gnu11; 336 | GCC_DYNAMIC_NO_PIC = NO; 337 | GCC_NO_COMMON_BLOCKS = YES; 338 | GCC_OPTIMIZATION_LEVEL = 0; 339 | GCC_PREPROCESSOR_DEFINITIONS = ( 340 | "DEBUG=1", 341 | "$(inherited)", 342 | ); 343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 345 | GCC_WARN_UNDECLARED_SELECTOR = YES; 346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 347 | GCC_WARN_UNUSED_FUNCTION = YES; 348 | GCC_WARN_UNUSED_VARIABLE = YES; 349 | IPHONEOS_DEPLOYMENT_TARGET = 14.2; 350 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 351 | MTL_FAST_MATH = YES; 352 | ONLY_ACTIVE_ARCH = YES; 353 | SDKROOT = iphoneos; 354 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 355 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 356 | }; 357 | name = Debug; 358 | }; 359 | 591B685125E29AC60003410A /* Release */ = { 360 | isa = XCBuildConfiguration; 361 | buildSettings = { 362 | ALWAYS_SEARCH_USER_PATHS = NO; 363 | CLANG_ANALYZER_NONNULL = YES; 364 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 365 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 366 | CLANG_CXX_LIBRARY = "libc++"; 367 | CLANG_ENABLE_MODULES = YES; 368 | CLANG_ENABLE_OBJC_ARC = YES; 369 | CLANG_ENABLE_OBJC_WEAK = YES; 370 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 371 | CLANG_WARN_BOOL_CONVERSION = YES; 372 | CLANG_WARN_COMMA = YES; 373 | CLANG_WARN_CONSTANT_CONVERSION = YES; 374 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 375 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 376 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 377 | CLANG_WARN_EMPTY_BODY = YES; 378 | CLANG_WARN_ENUM_CONVERSION = YES; 379 | CLANG_WARN_INFINITE_RECURSION = YES; 380 | CLANG_WARN_INT_CONVERSION = YES; 381 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 382 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 383 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 384 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 385 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 386 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 387 | CLANG_WARN_STRICT_PROTOTYPES = YES; 388 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 389 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 390 | CLANG_WARN_UNREACHABLE_CODE = YES; 391 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 392 | COPY_PHASE_STRIP = NO; 393 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 394 | ENABLE_NS_ASSERTIONS = NO; 395 | ENABLE_STRICT_OBJC_MSGSEND = YES; 396 | GCC_C_LANGUAGE_STANDARD = gnu11; 397 | GCC_NO_COMMON_BLOCKS = YES; 398 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 399 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 400 | GCC_WARN_UNDECLARED_SELECTOR = YES; 401 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 402 | GCC_WARN_UNUSED_FUNCTION = YES; 403 | GCC_WARN_UNUSED_VARIABLE = YES; 404 | IPHONEOS_DEPLOYMENT_TARGET = 14.2; 405 | MTL_ENABLE_DEBUG_INFO = NO; 406 | MTL_FAST_MATH = YES; 407 | SDKROOT = iphoneos; 408 | SWIFT_COMPILATION_MODE = wholemodule; 409 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 410 | VALIDATE_PRODUCT = YES; 411 | }; 412 | name = Release; 413 | }; 414 | 591B685325E29AC60003410A /* Debug */ = { 415 | isa = XCBuildConfiguration; 416 | buildSettings = { 417 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 418 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 419 | CODE_SIGN_STYLE = Automatic; 420 | DEVELOPMENT_TEAM = 6P6V53T36J; 421 | INFOPLIST_FILE = DeeplinkingWithChainPattern/Info.plist; 422 | LD_RUNPATH_SEARCH_PATHS = ( 423 | "$(inherited)", 424 | "@executable_path/Frameworks", 425 | ); 426 | PRODUCT_BUNDLE_IDENTIFIER = com.tangerine.DeeplinkingWithChainPattern; 427 | PRODUCT_NAME = "$(TARGET_NAME)"; 428 | SWIFT_VERSION = 5.0; 429 | TARGETED_DEVICE_FAMILY = "1,2"; 430 | }; 431 | name = Debug; 432 | }; 433 | 591B685425E29AC60003410A /* Release */ = { 434 | isa = XCBuildConfiguration; 435 | buildSettings = { 436 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 437 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 438 | CODE_SIGN_STYLE = Automatic; 439 | DEVELOPMENT_TEAM = 6P6V53T36J; 440 | INFOPLIST_FILE = DeeplinkingWithChainPattern/Info.plist; 441 | LD_RUNPATH_SEARCH_PATHS = ( 442 | "$(inherited)", 443 | "@executable_path/Frameworks", 444 | ); 445 | PRODUCT_BUNDLE_IDENTIFIER = com.tangerine.DeeplinkingWithChainPattern; 446 | PRODUCT_NAME = "$(TARGET_NAME)"; 447 | SWIFT_VERSION = 5.0; 448 | TARGETED_DEVICE_FAMILY = "1,2"; 449 | }; 450 | name = Release; 451 | }; 452 | 591B685625E29AC60003410A /* Debug */ = { 453 | isa = XCBuildConfiguration; 454 | buildSettings = { 455 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 456 | BUNDLE_LOADER = "$(TEST_HOST)"; 457 | CODE_SIGN_STYLE = Automatic; 458 | DEVELOPMENT_TEAM = 6P6V53T36J; 459 | INFOPLIST_FILE = DeeplinkingWithChainPatternTests/Info.plist; 460 | IPHONEOS_DEPLOYMENT_TARGET = 14.2; 461 | LD_RUNPATH_SEARCH_PATHS = ( 462 | "$(inherited)", 463 | "@executable_path/Frameworks", 464 | "@loader_path/Frameworks", 465 | ); 466 | PRODUCT_BUNDLE_IDENTIFIER = com.tangerine.DeeplinkingWithChainPatternTests; 467 | PRODUCT_NAME = "$(TARGET_NAME)"; 468 | SWIFT_VERSION = 5.0; 469 | TARGETED_DEVICE_FAMILY = "1,2"; 470 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DeeplinkingWithChainPattern.app/DeeplinkingWithChainPattern"; 471 | }; 472 | name = Debug; 473 | }; 474 | 591B685725E29AC60003410A /* Release */ = { 475 | isa = XCBuildConfiguration; 476 | buildSettings = { 477 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 478 | BUNDLE_LOADER = "$(TEST_HOST)"; 479 | CODE_SIGN_STYLE = Automatic; 480 | DEVELOPMENT_TEAM = 6P6V53T36J; 481 | INFOPLIST_FILE = DeeplinkingWithChainPatternTests/Info.plist; 482 | IPHONEOS_DEPLOYMENT_TARGET = 14.2; 483 | LD_RUNPATH_SEARCH_PATHS = ( 484 | "$(inherited)", 485 | "@executable_path/Frameworks", 486 | "@loader_path/Frameworks", 487 | ); 488 | PRODUCT_BUNDLE_IDENTIFIER = com.tangerine.DeeplinkingWithChainPatternTests; 489 | PRODUCT_NAME = "$(TARGET_NAME)"; 490 | SWIFT_VERSION = 5.0; 491 | TARGETED_DEVICE_FAMILY = "1,2"; 492 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DeeplinkingWithChainPattern.app/DeeplinkingWithChainPattern"; 493 | }; 494 | name = Release; 495 | }; 496 | /* End XCBuildConfiguration section */ 497 | 498 | /* Begin XCConfigurationList section */ 499 | 591B682325E29AC50003410A /* Build configuration list for PBXProject "DeeplinkingWithChainPattern" */ = { 500 | isa = XCConfigurationList; 501 | buildConfigurations = ( 502 | 591B685025E29AC60003410A /* Debug */, 503 | 591B685125E29AC60003410A /* Release */, 504 | ); 505 | defaultConfigurationIsVisible = 0; 506 | defaultConfigurationName = Release; 507 | }; 508 | 591B685225E29AC60003410A /* Build configuration list for PBXNativeTarget "DeeplinkingWithChainPattern" */ = { 509 | isa = XCConfigurationList; 510 | buildConfigurations = ( 511 | 591B685325E29AC60003410A /* Debug */, 512 | 591B685425E29AC60003410A /* Release */, 513 | ); 514 | defaultConfigurationIsVisible = 0; 515 | defaultConfigurationName = Release; 516 | }; 517 | 591B685525E29AC60003410A /* Build configuration list for PBXNativeTarget "DeeplinkingWithChainPatternTests" */ = { 518 | isa = XCConfigurationList; 519 | buildConfigurations = ( 520 | 591B685625E29AC60003410A /* Debug */, 521 | 591B685725E29AC60003410A /* Release */, 522 | ); 523 | defaultConfigurationIsVisible = 0; 524 | defaultConfigurationName = Release; 525 | }; 526 | /* End XCConfigurationList section */ 527 | }; 528 | rootObject = 591B682025E29AC50003410A /* Project object */; 529 | } 530 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern.xcodeproj/xcshareddata/xcschemes/DeeplinkingWithChainPattern.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 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern.xcodeproj/xcuserdata/ahmetkeskin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DeeplinkingWithChainPattern.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // DeeplinkingWithChainPattern 4 | // 5 | // Created by Ahmet Keskin on 21.02.2021. 6 | // 7 | 8 | import UIKit 9 | 10 | var deeplinkToOpen: [String: Any]? 11 | 12 | @main 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 15 | // Override point for customization after application launch. 16 | return true 17 | } 18 | 19 | // MARK: UISceneSession Lifecycle 20 | 21 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 22 | // Called when a new scene session is being created. 23 | // Use this method to select a configuration to create the new scene with. 24 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 25 | } 26 | 27 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 28 | // Called when the user discards a scene session. 29 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 30 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 31 | } 32 | 33 | 34 | } 35 | 36 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern/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 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern/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 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern/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 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern/Deeplink/DeeplinkManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DeeplinkManager.swift 3 | // DeeplinkingWithChainPattern 4 | // 5 | // Created by Ahmet Keskin on 21.02.2021. 6 | // 7 | 8 | import UIKit 9 | 10 | class DeeplinkManager { 11 | static let shared: DeeplinkManager = DeeplinkManager() 12 | 13 | private init() {} 14 | 15 | private let items: [DeeplinkableItem] = [ProductDetailDeeplinkItem(), 16 | OrderDetailDeeplinkItem()] 17 | 18 | func navigate(with params: [String: Any]) { 19 | guard let window = UIApplication.shared.windows.first else { return } 20 | items.first(where: { $0.isSatisfied(by: params)})?.execute(window, params: params) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern/Deeplink/DeeplinkableItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DeeplinkableItem.swift 3 | // DeeplinkingWithChainPattern 4 | // 5 | // Created by Ahmet Keskin on 21.02.2021. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | protocol DeeplinkableItem { 12 | func isSatisfied(by params: [String: Any]) -> Bool 13 | func execute(_ window: UIWindow, params: [String: Any]) 14 | } 15 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern/Deeplink/Items/OrderDetailDeeplinkItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OrderDetailDeeplinkItem.swift 3 | // DeeplinkingWithChainPattern 4 | // 5 | // Created by Ahmet Keskin on 21.02.2021. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | struct OrderDetailDeeplinkItem: DeeplinkableItem { 12 | func isSatisfied(by params: [String : Any]) -> Bool { 13 | guard let orderId = params["orderId"] as? String, !orderId.isEmpty else { return false } 14 | return true 15 | } 16 | 17 | func execute(_ window: UIWindow, params: [String : Any]) { 18 | guard let orderId = params["orderId"] as? String, !orderId.isEmpty else { return } 19 | let orderDetail = UIStoryboard(name: "Main", 20 | bundle: nil).instantiateViewController(withIdentifier: "OrderDetailViewController") as! OrderDetailViewController 21 | orderDetail.orderId = orderId 22 | let navigationController = window.rootViewController as? UINavigationController 23 | navigationController?.pushViewController(orderDetail, 24 | animated: true) 25 | } 26 | } 27 | 28 | /* 29 | chain-pattern://?orderId=123 30 | */ 31 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern/Deeplink/Items/ProductDetailDeeplinkItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProductDetailDeeplinkItem.swift 3 | // DeeplinkingWithChainPattern 4 | // 5 | // Created by Ahmet Keskin on 21.02.2021. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | struct ProductDetailDeeplinkItem: DeeplinkableItem { 12 | func isSatisfied(by params: [String : Any]) -> Bool { 13 | guard let productId = params["productId"] as? String, !productId.isEmpty else { return false } 14 | return true 15 | } 16 | 17 | func execute(_ window: UIWindow, params: [String : Any]) { 18 | guard let productId = params["productId"] as? String, !productId.isEmpty else { return } 19 | let productDetail = UIStoryboard(name: "Main", 20 | bundle: nil).instantiateViewController(withIdentifier: "ProductDetailViewController") as! ProductDetailViewController 21 | productDetail.productId = productId 22 | let navigationController = window.rootViewController as? UINavigationController 23 | navigationController?.pushViewController(productDetail, 24 | animated: true) 25 | } 26 | } 27 | 28 | /* 29 | chain-pattern://?productId=123 30 | */ 31 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | UISceneStoryboardFile 37 | Main 38 | 39 | 40 | 41 | 42 | UIApplicationSupportsIndirectInputEvents 43 | 44 | UILaunchStoryboardName 45 | LaunchScreen 46 | UIMainStoryboardFile 47 | Main 48 | UIRequiredDeviceCapabilities 49 | 50 | armv7 51 | 52 | UISupportedInterfaceOrientations 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationLandscapeLeft 56 | UIInterfaceOrientationLandscapeRight 57 | 58 | UISupportedInterfaceOrientations~ipad 59 | 60 | UIInterfaceOrientationPortrait 61 | UIInterfaceOrientationPortraitUpsideDown 62 | UIInterfaceOrientationLandscapeLeft 63 | UIInterfaceOrientationLandscapeRight 64 | 65 | CFBundleURLTypes 66 | 67 | 68 | CFBundleURLName 69 | com.tangerine 70 | CFBundleURLSchemes 71 | 72 | chain-pattern 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // DeeplinkingWithChainPattern 4 | // 5 | // Created by Ahmet Keskin on 21.02.2021. 6 | // 7 | 8 | import UIKit 9 | 10 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 11 | 12 | var window: UIWindow? 13 | 14 | 15 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 16 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 17 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 18 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 19 | 20 | // this logic is added for application killed state 21 | DispatchQueue.global(qos: .userInteractive).async { 22 | if let query = connectionOptions.urlContexts.first?.url.query { 23 | deeplinkToOpen = self.createMap(from: query) 24 | } 25 | } 26 | guard let _ = (scene as? UIWindowScene) else { return } 27 | } 28 | 29 | func sceneDidDisconnect(_ scene: UIScene) { 30 | // Called as the scene is being released by the system. 31 | // This occurs shortly after the scene enters the background, or when its session is discarded. 32 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 33 | // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). 34 | } 35 | 36 | func sceneDidBecomeActive(_ scene: UIScene) { 37 | // Called when the scene has moved from an inactive state to an active state. 38 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 39 | } 40 | 41 | func sceneWillResignActive(_ scene: UIScene) { 42 | // Called when the scene will move from an active state to an inactive state. 43 | // This may occur due to temporary interruptions (ex. an incoming phone call). 44 | } 45 | 46 | func sceneWillEnterForeground(_ scene: UIScene) { 47 | // Called as the scene transitions from the background to the foreground. 48 | // Use this method to undo the changes made on entering the background. 49 | } 50 | 51 | func sceneDidEnterBackground(_ scene: UIScene) { 52 | // Called as the scene transitions from the foreground to the background. 53 | // Use this method to save data, release shared resources, and store enough scene-specific state information 54 | // to restore the scene back to its current state. 55 | } 56 | 57 | 58 | func scene(_ scene: UIScene, openURLContexts URLContexts: Set) { 59 | guard let query = URLContexts.first?.url.query else { return } 60 | executeDeeplink(with: query) 61 | } 62 | 63 | private func executeDeeplink(with query: String) { 64 | let params = createMap(from: query) 65 | DeeplinkManager.shared.navigate(with: params) 66 | } 67 | 68 | private func createMap(from query: String) -> [String: Any] { 69 | let queryItems = query.components(separatedBy: "&") 70 | var params = [String: Any]() 71 | queryItems.forEach { (keyValue) in 72 | let separatedItems = keyValue.components(separatedBy: "=") 73 | params[separatedItems.first!] = separatedItems.last 74 | } 75 | return params 76 | } 77 | } 78 | 79 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern/ViewControllers/HomepageViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HomepageViewController.swift 3 | // DeeplinkingWithChainPattern 4 | // 5 | // Created by Ahmet Keskin on 21.02.2021. 6 | // 7 | 8 | import UIKit 9 | 10 | class HomepageViewController: UIViewController { 11 | 12 | override func viewDidLoad() { 13 | super.viewDidLoad() 14 | // Do any additional setup after loading the view. 15 | } 16 | 17 | override func viewWillAppear(_ animated: Bool) { 18 | super.viewWillAppear(animated) 19 | // If user launch app from deeplink | Killed state 20 | if let deeplink = deeplinkToOpen { 21 | DeeplinkManager.shared.navigate(with: deeplink) 22 | deeplinkToOpen = nil 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern/ViewControllers/OrderDetailViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OrderDetailViewController.swift 3 | // DeeplinkingWithChainPattern 4 | // 5 | // Created by Ahmet Keskin on 21.02.2021. 6 | // 7 | 8 | import UIKit 9 | 10 | class OrderDetailViewController: UIViewController { 11 | 12 | var orderId: String = "" 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | // Do any additional setup after loading the view. 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern/ViewControllers/ProductDetailViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProductDetailViewController.swift 3 | // DeeplinkingWithChainPattern 4 | // 5 | // Created by Ahmet Keskin on 21.02.2021. 6 | // 7 | 8 | import UIKit 9 | 10 | class ProductDetailViewController: UIViewController { 11 | 12 | var productId: String = "" 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | // Do any additional setup after loading the view. 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPattern/deeplink.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AhmettKeskin/DeeplinkingWithChainPattern/b8b9591e428bb8568b33fc40e4196c65290ff0a0/DeeplinkingWithChainPattern/deeplink.gif -------------------------------------------------------------------------------- /DeeplinkingWithChainPatternTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPatternTests/OrderDetailDeeplinkItemTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OrderDetailDeeplinkItemTests.swift 3 | // DeeplinkingWithChainPatternTests 4 | // 5 | // Created by Ahmet Keskin on 22.02.2021. 6 | // 7 | 8 | import XCTest 9 | @testable import DeeplinkingWithChainPattern 10 | 11 | class OrderDetailDeeplinkItemTests: XCTestCase { 12 | 13 | var item: OrderDetailDeeplinkItem! 14 | 15 | override func setUp() { 16 | self.item = OrderDetailDeeplinkItem() 17 | } 18 | 19 | func test_isSatisfied_OrderIdExist_ShouldReturnTrue() { 20 | let params = ["orderId": "123"] 21 | XCTAssertTrue(item.isSatisfied(by: params)) 22 | } 23 | 24 | func test_isSatisfied_OrderIdNotExist_ShouldReturnFalse() { 25 | let params = ["ahmet": "123"] 26 | XCTAssertFalse(item.isSatisfied(by: params)) 27 | } 28 | 29 | func test_isSatisfied_OrderIdEmpty_ShouldReturnFalse() { 30 | let params = ["orderId": ""] 31 | XCTAssertFalse(item.isSatisfied(by: params)) 32 | } 33 | 34 | func test_execute_OrderIdExist_OrderDetailPagePushedProperly() { 35 | let params = ["orderId": "123"] 36 | let window = UIWindow() 37 | window.rootViewController = UINavigationController() 38 | 39 | item.execute(window, params: params) 40 | 41 | let navigationStackVCs = (window.rootViewController as? UINavigationController)?.viewControllers 42 | 43 | XCTAssertEqual(navigationStackVCs?.count, 1) 44 | XCTAssertTrue(navigationStackVCs?.last is OrderDetailViewController) 45 | XCTAssertEqual((navigationStackVCs?.last as? OrderDetailViewController)?.orderId, "123") 46 | } 47 | 48 | func test_execute_OrderIdNotExist_NavigationStackShouldBeNil() { 49 | let params = ["ahmet": "asdasdasd"] 50 | let window = UIWindow() 51 | window.rootViewController = UINavigationController() 52 | 53 | item.execute(window, params: params) 54 | 55 | let navigationStackVCs = (window.rootViewController as? UINavigationController)?.viewControllers 56 | 57 | XCTAssertEqual(navigationStackVCs?.count, 0) 58 | } 59 | 60 | func test_execute_OrderIdIsEmpty_NavigationStackShouldBeNil() { 61 | let params = ["orderId": ""] 62 | let window = UIWindow() 63 | window.rootViewController = UINavigationController() 64 | 65 | item.execute(window, params: params) 66 | 67 | let navigationStackVCs = (window.rootViewController as? UINavigationController)?.viewControllers 68 | 69 | XCTAssertEqual(navigationStackVCs?.count, 0) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /DeeplinkingWithChainPatternTests/ProductDetailDeeplinkItemTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProductDetailDeeplinkItemTests.swift 3 | // DeeplinkingWithChainPatternTests 4 | // 5 | // Created by Ahmet Keskin on 22.02.2021. 6 | // 7 | 8 | import XCTest 9 | @testable import DeeplinkingWithChainPattern 10 | 11 | class ProductDetailDeeplinkItemTests: XCTestCase { 12 | 13 | var item: ProductDetailDeeplinkItem! 14 | 15 | override func setUp() { 16 | self.item = ProductDetailDeeplinkItem() 17 | } 18 | 19 | func test_isSatisfied_ProductIdExist_ShouldReturnTrue() { 20 | let params = ["productId": "123"] 21 | XCTAssertTrue(item.isSatisfied(by: params)) 22 | } 23 | 24 | func test_isSatisfied_ProductIdNotExist_ShouldReturnFalse() { 25 | let params = ["ahmet": "123"] 26 | XCTAssertFalse(item.isSatisfied(by: params)) 27 | } 28 | 29 | func test_isSatisfied_ProductIdEmpty_ShouldReturnFalse() { 30 | let params = ["productId": ""] 31 | XCTAssertFalse(item.isSatisfied(by: params)) 32 | } 33 | 34 | func test_execute_ProductIdExist_ProductDetailPagePushedProperly() { 35 | let params = ["productId": "123"] 36 | let window = UIWindow() 37 | window.rootViewController = UINavigationController() 38 | 39 | item.execute(window, params: params) 40 | 41 | let navigationStackVCs = (window.rootViewController as? UINavigationController)?.viewControllers 42 | 43 | XCTAssertEqual(navigationStackVCs?.count, 1) 44 | XCTAssertTrue(navigationStackVCs?.last is ProductDetailViewController) 45 | XCTAssertEqual((navigationStackVCs?.last as? ProductDetailViewController)?.productId, "123") 46 | } 47 | 48 | func test_execute_ProductIdNotExist_NavigationStackShouldBeNil() { 49 | let params = ["ahmet": "asdasdasd"] 50 | let window = UIWindow() 51 | window.rootViewController = UINavigationController() 52 | 53 | item.execute(window, params: params) 54 | 55 | let navigationStackVCs = (window.rootViewController as? UINavigationController)?.viewControllers 56 | 57 | XCTAssertEqual(navigationStackVCs?.count, 0) 58 | } 59 | 60 | func test_execute_ProductIdIsEmpty_NavigationStackShouldBeNil() { 61 | let params = ["productId": ""] 62 | let window = UIWindow() 63 | window.rootViewController = UINavigationController() 64 | 65 | item.execute(window, params: params) 66 | 67 | let navigationStackVCs = (window.rootViewController as? UINavigationController)?.viewControllers 68 | 69 | XCTAssertEqual(navigationStackVCs?.count, 0) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Welcome to example of ***chain of responsibility pattern*** in real iOS Projects. I have tried to explain how to use it in blog post 👇🏻 2 | 3 | https://ahmetkeskin.medium.com/handle-deep-linking-with-chain-of-responsibility-pattern-815902a9dc50 4 | 5 | The main purpose of the example project is that how do we use SOLID's two prinsiples; 6 | - Single Responsibility 7 | - Open-Closed 8 | 9 | and one of the design patters; 10 | - Strategy Pattern 11 | 12 | and bonus --> added some unit test for deeplink items ^_^ 13 | 14 | ![](https://github.com/AhmettKeskin/DeeplinkingWithChainPattern/blob/main/DeeplinkingWithChainPattern/deeplink.gif) 15 | --------------------------------------------------------------------------------