├── .gitignore ├── IslandGuide.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── IslandGuide ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── seals │ │ ├── Contents.json │ │ ├── seal1.imageset │ │ │ ├── Contents.json │ │ │ └── seal1.png │ │ ├── seal2.imageset │ │ │ ├── Contents.json │ │ │ └── seal2.png │ │ ├── seal3.imageset │ │ │ ├── Contents.json │ │ │ └── seal3.png │ │ ├── seal4.imageset │ │ │ ├── Contents.json │ │ │ └── seal4.png │ │ └── seal5.imageset │ │ │ ├── Contents.json │ │ │ └── seal5.png │ └── spots │ │ ├── Contents.json │ │ ├── spot1.imageset │ │ ├── Contents.json │ │ └── spot1.png │ │ ├── spot2.imageset │ │ ├── Contents.json │ │ └── spot2.png │ │ ├── spot3.imageset │ │ ├── Contents.json │ │ └── spot3.png │ │ ├── spot4.imageset │ │ ├── Contents.json │ │ └── spot4.png │ │ ├── spot5.imageset │ │ ├── Contents.json │ │ └── spot5.png │ │ ├── spot6.imageset │ │ ├── Contents.json │ │ └── spot6.png │ │ └── spot7.imageset │ │ ├── Contents.json │ │ └── spot7.png ├── Base.lproj │ └── LaunchScreen.storyboard ├── Implementation │ ├── Cells │ │ ├── CoolSpotCollectionViewCell.swift │ │ ├── CuteSealCollectionViewCell.swift │ │ ├── FunActivityCollectionViewCell.swift │ │ ├── Helper │ │ │ └── ReuseIdentifierHelper.swift │ │ └── SupplementaryViews.swift │ ├── Data │ │ ├── AppData.swift │ │ └── DataModels.swift │ └── ViewControllers │ │ └── GuideViewController.swift └── Info.plist ├── IslandGuideTests ├── Info.plist └── IslandGuideTests.swift ├── LICENSE ├── README.md └── demo.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | # Package.resolved 41 | .build/ 42 | 43 | # CocoaPods 44 | # 45 | # We recommend against adding the Pods directory to your .gitignore. However 46 | # you should judge for yourself, the pros and cons are mentioned at: 47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 48 | # 49 | # Pods/ 50 | 51 | # Carthage 52 | # 53 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 54 | # Carthage/Checkouts 55 | 56 | Carthage/Build 57 | 58 | # fastlane 59 | # 60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 61 | # screenshots whenever they are needed. 62 | # For more information about the recommended setup visit: 63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 64 | 65 | fastlane/report.xml 66 | fastlane/Preview.html 67 | fastlane/screenshots/**/*.png 68 | fastlane/test_output 69 | -------------------------------------------------------------------------------- /IslandGuide.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B30BDF4C22C7D67600D32BC0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B30BDF4B22C7D67600D32BC0 /* AppDelegate.swift */; }; 11 | B30BDF5522C7D67700D32BC0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B30BDF5422C7D67700D32BC0 /* Assets.xcassets */; }; 12 | B30BDF5822C7D67700D32BC0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B30BDF5622C7D67700D32BC0 /* LaunchScreen.storyboard */; }; 13 | B30BDF6322C7D67800D32BC0 /* IslandGuideTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B30BDF6222C7D67800D32BC0 /* IslandGuideTests.swift */; }; 14 | B30BDF7022C7D73800D32BC0 /* DataModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = B30BDF6F22C7D73800D32BC0 /* DataModels.swift */; }; 15 | B30BDF7622C7D82600D32BC0 /* CoolSpotCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B30BDF7422C7D82600D32BC0 /* CoolSpotCollectionViewCell.swift */; }; 16 | B30BDF7D22C7DEAE00D32BC0 /* AppData.swift in Sources */ = {isa = PBXBuildFile; fileRef = B30BDF7C22C7DEAE00D32BC0 /* AppData.swift */; }; 17 | B30BDF7F22C7E18800D32BC0 /* ReuseIdentifierHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B30BDF7E22C7E18800D32BC0 /* ReuseIdentifierHelper.swift */; }; 18 | B30BDF8122C7F4CE00D32BC0 /* FunActivityCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B30BDF8022C7F4CE00D32BC0 /* FunActivityCollectionViewCell.swift */; }; 19 | B30BDF8322C7F53B00D32BC0 /* CuteSealCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B30BDF8222C7F53B00D32BC0 /* CuteSealCollectionViewCell.swift */; }; 20 | B30BDF8522C7FD2900D32BC0 /* GuideViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B30BDF8422C7FD2900D32BC0 /* GuideViewController.swift */; }; 21 | B32B20C622CCD3620093EBF7 /* SupplementaryViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = B32B20C522CCD3620093EBF7 /* SupplementaryViews.swift */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXContainerItemProxy section */ 25 | B30BDF5F22C7D67800D32BC0 /* PBXContainerItemProxy */ = { 26 | isa = PBXContainerItemProxy; 27 | containerPortal = B30BDF4022C7D67600D32BC0 /* Project object */; 28 | proxyType = 1; 29 | remoteGlobalIDString = B30BDF4722C7D67600D32BC0; 30 | remoteInfo = IslandGuide; 31 | }; 32 | /* End PBXContainerItemProxy section */ 33 | 34 | /* Begin PBXFileReference section */ 35 | B30BDF4822C7D67600D32BC0 /* IslandGuide.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IslandGuide.app; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | B30BDF4B22C7D67600D32BC0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | B30BDF5422C7D67700D32BC0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 38 | B30BDF5722C7D67700D32BC0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 39 | B30BDF5922C7D67700D32BC0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | B30BDF5E22C7D67800D32BC0 /* IslandGuideTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = IslandGuideTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | B30BDF6222C7D67800D32BC0 /* IslandGuideTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IslandGuideTests.swift; sourceTree = ""; }; 42 | B30BDF6422C7D67800D32BC0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | B30BDF6D22C7D69800D32BC0 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 44 | B30BDF6F22C7D73800D32BC0 /* DataModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataModels.swift; sourceTree = ""; }; 45 | B30BDF7422C7D82600D32BC0 /* CoolSpotCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoolSpotCollectionViewCell.swift; sourceTree = ""; }; 46 | B30BDF7C22C7DEAE00D32BC0 /* AppData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppData.swift; sourceTree = ""; }; 47 | B30BDF7E22C7E18800D32BC0 /* ReuseIdentifierHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReuseIdentifierHelper.swift; sourceTree = ""; }; 48 | B30BDF8022C7F4CE00D32BC0 /* FunActivityCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FunActivityCollectionViewCell.swift; sourceTree = ""; }; 49 | B30BDF8222C7F53B00D32BC0 /* CuteSealCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CuteSealCollectionViewCell.swift; sourceTree = ""; }; 50 | B30BDF8422C7FD2900D32BC0 /* GuideViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GuideViewController.swift; sourceTree = ""; }; 51 | B32B20C522CCD3620093EBF7 /* SupplementaryViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SupplementaryViews.swift; sourceTree = ""; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | B30BDF4522C7D67600D32BC0 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | B30BDF5B22C7D67800D32BC0 /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | ); 67 | runOnlyForDeploymentPostprocessing = 0; 68 | }; 69 | /* End PBXFrameworksBuildPhase section */ 70 | 71 | /* Begin PBXGroup section */ 72 | B30BDF3F22C7D67600D32BC0 = { 73 | isa = PBXGroup; 74 | children = ( 75 | B30BDF6D22C7D69800D32BC0 /* README.md */, 76 | B30BDF4A22C7D67600D32BC0 /* IslandGuide */, 77 | B30BDF6122C7D67800D32BC0 /* IslandGuideTests */, 78 | B30BDF4922C7D67600D32BC0 /* Products */, 79 | ); 80 | sourceTree = ""; 81 | }; 82 | B30BDF4922C7D67600D32BC0 /* Products */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | B30BDF4822C7D67600D32BC0 /* IslandGuide.app */, 86 | B30BDF5E22C7D67800D32BC0 /* IslandGuideTests.xctest */, 87 | ); 88 | name = Products; 89 | sourceTree = ""; 90 | }; 91 | B30BDF4A22C7D67600D32BC0 /* IslandGuide */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | B30BDF6E22C7D6F600D32BC0 /* Implementation */, 95 | B30BDF4B22C7D67600D32BC0 /* AppDelegate.swift */, 96 | B30BDF5422C7D67700D32BC0 /* Assets.xcassets */, 97 | B30BDF5622C7D67700D32BC0 /* LaunchScreen.storyboard */, 98 | B30BDF5922C7D67700D32BC0 /* Info.plist */, 99 | ); 100 | path = IslandGuide; 101 | sourceTree = ""; 102 | }; 103 | B30BDF6122C7D67800D32BC0 /* IslandGuideTests */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | B30BDF6222C7D67800D32BC0 /* IslandGuideTests.swift */, 107 | B30BDF6422C7D67800D32BC0 /* Info.plist */, 108 | ); 109 | path = IslandGuideTests; 110 | sourceTree = ""; 111 | }; 112 | B30BDF6E22C7D6F600D32BC0 /* Implementation */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | B30BDF7122C7D7DA00D32BC0 /* Data */, 116 | B30BDF7322C7D7F000D32BC0 /* Cells */, 117 | B30BDF7222C7D7E100D32BC0 /* ViewControllers */, 118 | ); 119 | path = Implementation; 120 | sourceTree = ""; 121 | }; 122 | B30BDF7122C7D7DA00D32BC0 /* Data */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | B30BDF6F22C7D73800D32BC0 /* DataModels.swift */, 126 | B30BDF7C22C7DEAE00D32BC0 /* AppData.swift */, 127 | ); 128 | path = Data; 129 | sourceTree = ""; 130 | }; 131 | B30BDF7222C7D7E100D32BC0 /* ViewControllers */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | B30BDF8422C7FD2900D32BC0 /* GuideViewController.swift */, 135 | ); 136 | path = ViewControllers; 137 | sourceTree = ""; 138 | }; 139 | B30BDF7322C7D7F000D32BC0 /* Cells */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | B32B20C722CCE0F00093EBF7 /* Helper */, 143 | B30BDF7422C7D82600D32BC0 /* CoolSpotCollectionViewCell.swift */, 144 | B30BDF8222C7F53B00D32BC0 /* CuteSealCollectionViewCell.swift */, 145 | B30BDF8022C7F4CE00D32BC0 /* FunActivityCollectionViewCell.swift */, 146 | B32B20C522CCD3620093EBF7 /* SupplementaryViews.swift */, 147 | ); 148 | path = Cells; 149 | sourceTree = ""; 150 | }; 151 | B32B20C722CCE0F00093EBF7 /* Helper */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | B30BDF7E22C7E18800D32BC0 /* ReuseIdentifierHelper.swift */, 155 | ); 156 | path = Helper; 157 | sourceTree = ""; 158 | }; 159 | /* End PBXGroup section */ 160 | 161 | /* Begin PBXNativeTarget section */ 162 | B30BDF4722C7D67600D32BC0 /* IslandGuide */ = { 163 | isa = PBXNativeTarget; 164 | buildConfigurationList = B30BDF6722C7D67800D32BC0 /* Build configuration list for PBXNativeTarget "IslandGuide" */; 165 | buildPhases = ( 166 | B30BDF4422C7D67600D32BC0 /* Sources */, 167 | B30BDF4522C7D67600D32BC0 /* Frameworks */, 168 | B30BDF4622C7D67600D32BC0 /* Resources */, 169 | ); 170 | buildRules = ( 171 | ); 172 | dependencies = ( 173 | ); 174 | name = IslandGuide; 175 | productName = IslandGuide; 176 | productReference = B30BDF4822C7D67600D32BC0 /* IslandGuide.app */; 177 | productType = "com.apple.product-type.application"; 178 | }; 179 | B30BDF5D22C7D67800D32BC0 /* IslandGuideTests */ = { 180 | isa = PBXNativeTarget; 181 | buildConfigurationList = B30BDF6A22C7D67800D32BC0 /* Build configuration list for PBXNativeTarget "IslandGuideTests" */; 182 | buildPhases = ( 183 | B30BDF5A22C7D67800D32BC0 /* Sources */, 184 | B30BDF5B22C7D67800D32BC0 /* Frameworks */, 185 | B30BDF5C22C7D67800D32BC0 /* Resources */, 186 | ); 187 | buildRules = ( 188 | ); 189 | dependencies = ( 190 | B30BDF6022C7D67800D32BC0 /* PBXTargetDependency */, 191 | ); 192 | name = IslandGuideTests; 193 | productName = IslandGuideTests; 194 | productReference = B30BDF5E22C7D67800D32BC0 /* IslandGuideTests.xctest */; 195 | productType = "com.apple.product-type.bundle.unit-test"; 196 | }; 197 | /* End PBXNativeTarget section */ 198 | 199 | /* Begin PBXProject section */ 200 | B30BDF4022C7D67600D32BC0 /* Project object */ = { 201 | isa = PBXProject; 202 | attributes = { 203 | LastSwiftUpdateCheck = 1100; 204 | LastUpgradeCheck = 1100; 205 | ORGANIZATIONNAME = SwiftIsland; 206 | TargetAttributes = { 207 | B30BDF4722C7D67600D32BC0 = { 208 | CreatedOnToolsVersion = 11.0; 209 | }; 210 | B30BDF5D22C7D67800D32BC0 = { 211 | CreatedOnToolsVersion = 11.0; 212 | TestTargetID = B30BDF4722C7D67600D32BC0; 213 | }; 214 | }; 215 | }; 216 | buildConfigurationList = B30BDF4322C7D67600D32BC0 /* Build configuration list for PBXProject "IslandGuide" */; 217 | compatibilityVersion = "Xcode 9.3"; 218 | developmentRegion = en; 219 | hasScannedForEncodings = 0; 220 | knownRegions = ( 221 | en, 222 | Base, 223 | ); 224 | mainGroup = B30BDF3F22C7D67600D32BC0; 225 | productRefGroup = B30BDF4922C7D67600D32BC0 /* Products */; 226 | projectDirPath = ""; 227 | projectRoot = ""; 228 | targets = ( 229 | B30BDF4722C7D67600D32BC0 /* IslandGuide */, 230 | B30BDF5D22C7D67800D32BC0 /* IslandGuideTests */, 231 | ); 232 | }; 233 | /* End PBXProject section */ 234 | 235 | /* Begin PBXResourcesBuildPhase section */ 236 | B30BDF4622C7D67600D32BC0 /* Resources */ = { 237 | isa = PBXResourcesBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | B30BDF5822C7D67700D32BC0 /* LaunchScreen.storyboard in Resources */, 241 | B30BDF5522C7D67700D32BC0 /* Assets.xcassets in Resources */, 242 | ); 243 | runOnlyForDeploymentPostprocessing = 0; 244 | }; 245 | B30BDF5C22C7D67800D32BC0 /* Resources */ = { 246 | isa = PBXResourcesBuildPhase; 247 | buildActionMask = 2147483647; 248 | files = ( 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | /* End PBXResourcesBuildPhase section */ 253 | 254 | /* Begin PBXSourcesBuildPhase section */ 255 | B30BDF4422C7D67600D32BC0 /* Sources */ = { 256 | isa = PBXSourcesBuildPhase; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | B30BDF8522C7FD2900D32BC0 /* GuideViewController.swift in Sources */, 260 | B30BDF7D22C7DEAE00D32BC0 /* AppData.swift in Sources */, 261 | B30BDF7022C7D73800D32BC0 /* DataModels.swift in Sources */, 262 | B30BDF8322C7F53B00D32BC0 /* CuteSealCollectionViewCell.swift in Sources */, 263 | B30BDF4C22C7D67600D32BC0 /* AppDelegate.swift in Sources */, 264 | B30BDF7F22C7E18800D32BC0 /* ReuseIdentifierHelper.swift in Sources */, 265 | B32B20C622CCD3620093EBF7 /* SupplementaryViews.swift in Sources */, 266 | B30BDF8122C7F4CE00D32BC0 /* FunActivityCollectionViewCell.swift in Sources */, 267 | B30BDF7622C7D82600D32BC0 /* CoolSpotCollectionViewCell.swift in Sources */, 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | }; 271 | B30BDF5A22C7D67800D32BC0 /* Sources */ = { 272 | isa = PBXSourcesBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | B30BDF6322C7D67800D32BC0 /* IslandGuideTests.swift in Sources */, 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | /* End PBXSourcesBuildPhase section */ 280 | 281 | /* Begin PBXTargetDependency section */ 282 | B30BDF6022C7D67800D32BC0 /* PBXTargetDependency */ = { 283 | isa = PBXTargetDependency; 284 | target = B30BDF4722C7D67600D32BC0 /* IslandGuide */; 285 | targetProxy = B30BDF5F22C7D67800D32BC0 /* PBXContainerItemProxy */; 286 | }; 287 | /* End PBXTargetDependency section */ 288 | 289 | /* Begin PBXVariantGroup section */ 290 | B30BDF5622C7D67700D32BC0 /* LaunchScreen.storyboard */ = { 291 | isa = PBXVariantGroup; 292 | children = ( 293 | B30BDF5722C7D67700D32BC0 /* Base */, 294 | ); 295 | name = LaunchScreen.storyboard; 296 | sourceTree = ""; 297 | }; 298 | /* End PBXVariantGroup section */ 299 | 300 | /* Begin XCBuildConfiguration section */ 301 | B30BDF6522C7D67800D32BC0 /* Debug */ = { 302 | isa = XCBuildConfiguration; 303 | buildSettings = { 304 | ALWAYS_SEARCH_USER_PATHS = NO; 305 | CLANG_ANALYZER_NONNULL = YES; 306 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 307 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 308 | CLANG_CXX_LIBRARY = "libc++"; 309 | CLANG_ENABLE_MODULES = YES; 310 | CLANG_ENABLE_OBJC_ARC = YES; 311 | CLANG_ENABLE_OBJC_WEAK = YES; 312 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 313 | CLANG_WARN_BOOL_CONVERSION = YES; 314 | CLANG_WARN_COMMA = YES; 315 | CLANG_WARN_CONSTANT_CONVERSION = YES; 316 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 317 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 318 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 319 | CLANG_WARN_EMPTY_BODY = YES; 320 | CLANG_WARN_ENUM_CONVERSION = YES; 321 | CLANG_WARN_INFINITE_RECURSION = YES; 322 | CLANG_WARN_INT_CONVERSION = YES; 323 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 324 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 325 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 326 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 327 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 328 | CLANG_WARN_STRICT_PROTOTYPES = YES; 329 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 330 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 331 | CLANG_WARN_UNREACHABLE_CODE = YES; 332 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 333 | COPY_PHASE_STRIP = NO; 334 | DEBUG_INFORMATION_FORMAT = dwarf; 335 | ENABLE_STRICT_OBJC_MSGSEND = YES; 336 | ENABLE_TESTABILITY = YES; 337 | GCC_C_LANGUAGE_STANDARD = gnu11; 338 | GCC_DYNAMIC_NO_PIC = NO; 339 | GCC_NO_COMMON_BLOCKS = YES; 340 | GCC_OPTIMIZATION_LEVEL = 0; 341 | GCC_PREPROCESSOR_DEFINITIONS = ( 342 | "DEBUG=1", 343 | "$(inherited)", 344 | ); 345 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 346 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 347 | GCC_WARN_UNDECLARED_SELECTOR = YES; 348 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 349 | GCC_WARN_UNUSED_FUNCTION = YES; 350 | GCC_WARN_UNUSED_VARIABLE = YES; 351 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 352 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 353 | MTL_FAST_MATH = YES; 354 | ONLY_ACTIVE_ARCH = YES; 355 | SDKROOT = iphoneos; 356 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 357 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 358 | }; 359 | name = Debug; 360 | }; 361 | B30BDF6622C7D67800D32BC0 /* Release */ = { 362 | isa = XCBuildConfiguration; 363 | buildSettings = { 364 | ALWAYS_SEARCH_USER_PATHS = NO; 365 | CLANG_ANALYZER_NONNULL = YES; 366 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 367 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 368 | CLANG_CXX_LIBRARY = "libc++"; 369 | CLANG_ENABLE_MODULES = YES; 370 | CLANG_ENABLE_OBJC_ARC = YES; 371 | CLANG_ENABLE_OBJC_WEAK = YES; 372 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 373 | CLANG_WARN_BOOL_CONVERSION = YES; 374 | CLANG_WARN_COMMA = YES; 375 | CLANG_WARN_CONSTANT_CONVERSION = YES; 376 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 377 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 378 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 379 | CLANG_WARN_EMPTY_BODY = YES; 380 | CLANG_WARN_ENUM_CONVERSION = YES; 381 | CLANG_WARN_INFINITE_RECURSION = YES; 382 | CLANG_WARN_INT_CONVERSION = YES; 383 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 384 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 385 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 386 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 387 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 388 | CLANG_WARN_STRICT_PROTOTYPES = YES; 389 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 390 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 391 | CLANG_WARN_UNREACHABLE_CODE = YES; 392 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 393 | COPY_PHASE_STRIP = NO; 394 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 395 | ENABLE_NS_ASSERTIONS = NO; 396 | ENABLE_STRICT_OBJC_MSGSEND = YES; 397 | GCC_C_LANGUAGE_STANDARD = gnu11; 398 | GCC_NO_COMMON_BLOCKS = YES; 399 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 400 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 401 | GCC_WARN_UNDECLARED_SELECTOR = YES; 402 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 403 | GCC_WARN_UNUSED_FUNCTION = YES; 404 | GCC_WARN_UNUSED_VARIABLE = YES; 405 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 406 | MTL_ENABLE_DEBUG_INFO = NO; 407 | MTL_FAST_MATH = YES; 408 | SDKROOT = iphoneos; 409 | SWIFT_COMPILATION_MODE = wholemodule; 410 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 411 | VALIDATE_PRODUCT = YES; 412 | }; 413 | name = Release; 414 | }; 415 | B30BDF6822C7D67800D32BC0 /* Debug */ = { 416 | isa = XCBuildConfiguration; 417 | buildSettings = { 418 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 419 | CODE_SIGN_STYLE = Automatic; 420 | INFOPLIST_FILE = IslandGuide/Info.plist; 421 | LD_RUNPATH_SEARCH_PATHS = ( 422 | "$(inherited)", 423 | "@executable_path/Frameworks", 424 | ); 425 | PRODUCT_BUNDLE_IDENTIFIER = com.swiftisland.IslandGuide; 426 | PRODUCT_NAME = "$(TARGET_NAME)"; 427 | SWIFT_VERSION = 5.0; 428 | TARGETED_DEVICE_FAMILY = "1,2"; 429 | }; 430 | name = Debug; 431 | }; 432 | B30BDF6922C7D67800D32BC0 /* Release */ = { 433 | isa = XCBuildConfiguration; 434 | buildSettings = { 435 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 436 | CODE_SIGN_STYLE = Automatic; 437 | INFOPLIST_FILE = IslandGuide/Info.plist; 438 | LD_RUNPATH_SEARCH_PATHS = ( 439 | "$(inherited)", 440 | "@executable_path/Frameworks", 441 | ); 442 | PRODUCT_BUNDLE_IDENTIFIER = com.swiftisland.IslandGuide; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | SWIFT_VERSION = 5.0; 445 | TARGETED_DEVICE_FAMILY = "1,2"; 446 | }; 447 | name = Release; 448 | }; 449 | B30BDF6B22C7D67800D32BC0 /* Debug */ = { 450 | isa = XCBuildConfiguration; 451 | buildSettings = { 452 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 453 | BUNDLE_LOADER = "$(TEST_HOST)"; 454 | CODE_SIGN_STYLE = Automatic; 455 | INFOPLIST_FILE = IslandGuideTests/Info.plist; 456 | LD_RUNPATH_SEARCH_PATHS = ( 457 | "$(inherited)", 458 | "@executable_path/Frameworks", 459 | "@loader_path/Frameworks", 460 | ); 461 | PRODUCT_BUNDLE_IDENTIFIER = com.swiftisland.IslandGuideTests; 462 | PRODUCT_NAME = "$(TARGET_NAME)"; 463 | SWIFT_VERSION = 5.0; 464 | TARGETED_DEVICE_FAMILY = "1,2"; 465 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/IslandGuide.app/IslandGuide"; 466 | }; 467 | name = Debug; 468 | }; 469 | B30BDF6C22C7D67800D32BC0 /* Release */ = { 470 | isa = XCBuildConfiguration; 471 | buildSettings = { 472 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 473 | BUNDLE_LOADER = "$(TEST_HOST)"; 474 | CODE_SIGN_STYLE = Automatic; 475 | INFOPLIST_FILE = IslandGuideTests/Info.plist; 476 | LD_RUNPATH_SEARCH_PATHS = ( 477 | "$(inherited)", 478 | "@executable_path/Frameworks", 479 | "@loader_path/Frameworks", 480 | ); 481 | PRODUCT_BUNDLE_IDENTIFIER = com.swiftisland.IslandGuideTests; 482 | PRODUCT_NAME = "$(TARGET_NAME)"; 483 | SWIFT_VERSION = 5.0; 484 | TARGETED_DEVICE_FAMILY = "1,2"; 485 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/IslandGuide.app/IslandGuide"; 486 | }; 487 | name = Release; 488 | }; 489 | /* End XCBuildConfiguration section */ 490 | 491 | /* Begin XCConfigurationList section */ 492 | B30BDF4322C7D67600D32BC0 /* Build configuration list for PBXProject "IslandGuide" */ = { 493 | isa = XCConfigurationList; 494 | buildConfigurations = ( 495 | B30BDF6522C7D67800D32BC0 /* Debug */, 496 | B30BDF6622C7D67800D32BC0 /* Release */, 497 | ); 498 | defaultConfigurationIsVisible = 0; 499 | defaultConfigurationName = Release; 500 | }; 501 | B30BDF6722C7D67800D32BC0 /* Build configuration list for PBXNativeTarget "IslandGuide" */ = { 502 | isa = XCConfigurationList; 503 | buildConfigurations = ( 504 | B30BDF6822C7D67800D32BC0 /* Debug */, 505 | B30BDF6922C7D67800D32BC0 /* Release */, 506 | ); 507 | defaultConfigurationIsVisible = 0; 508 | defaultConfigurationName = Release; 509 | }; 510 | B30BDF6A22C7D67800D32BC0 /* Build configuration list for PBXNativeTarget "IslandGuideTests" */ = { 511 | isa = XCConfigurationList; 512 | buildConfigurations = ( 513 | B30BDF6B22C7D67800D32BC0 /* Debug */, 514 | B30BDF6C22C7D67800D32BC0 /* Release */, 515 | ); 516 | defaultConfigurationIsVisible = 0; 517 | defaultConfigurationName = Release; 518 | }; 519 | /* End XCConfigurationList section */ 520 | }; 521 | rootObject = B30BDF4022C7D67600D32BC0 /* Project object */; 522 | } 523 | -------------------------------------------------------------------------------- /IslandGuide.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /IslandGuide.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /IslandGuide/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // IslandGuide 4 | // 5 | // Created by Marina Gornostaeva on 29/06/2019. 6 | // Copyright © 2019 SwiftIsland. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | var window: UIWindow? 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | 20 | let window = UIWindow(frame: UIScreen.main.bounds) 21 | self.window = window 22 | 23 | let vc = GuideViewController() 24 | let nav = UINavigationController(rootViewController: vc) 25 | nav.navigationBar.prefersLargeTitles = true 26 | window.rootViewController = nav 27 | 28 | window.makeKeyAndVisible() 29 | return true 30 | } 31 | 32 | func applicationWillTerminate(_ application: UIApplication) { 33 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/seals/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/seals/seal1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "seal1.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/seals/seal1.imageset/seal1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hybridcattt/IslandGuideSample/5ec4831030a7cc747c9911a1f91f6be0dc17a6d5/IslandGuide/Assets.xcassets/seals/seal1.imageset/seal1.png -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/seals/seal2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "seal2.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/seals/seal2.imageset/seal2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hybridcattt/IslandGuideSample/5ec4831030a7cc747c9911a1f91f6be0dc17a6d5/IslandGuide/Assets.xcassets/seals/seal2.imageset/seal2.png -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/seals/seal3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "seal3.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/seals/seal3.imageset/seal3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hybridcattt/IslandGuideSample/5ec4831030a7cc747c9911a1f91f6be0dc17a6d5/IslandGuide/Assets.xcassets/seals/seal3.imageset/seal3.png -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/seals/seal4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "seal4.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/seals/seal4.imageset/seal4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hybridcattt/IslandGuideSample/5ec4831030a7cc747c9911a1f91f6be0dc17a6d5/IslandGuide/Assets.xcassets/seals/seal4.imageset/seal4.png -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/seals/seal5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "seal5.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/seals/seal5.imageset/seal5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hybridcattt/IslandGuideSample/5ec4831030a7cc747c9911a1f91f6be0dc17a6d5/IslandGuide/Assets.xcassets/seals/seal5.imageset/seal5.png -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/spots/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/spots/spot1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "spot1.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/spots/spot1.imageset/spot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hybridcattt/IslandGuideSample/5ec4831030a7cc747c9911a1f91f6be0dc17a6d5/IslandGuide/Assets.xcassets/spots/spot1.imageset/spot1.png -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/spots/spot2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "spot2.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/spots/spot2.imageset/spot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hybridcattt/IslandGuideSample/5ec4831030a7cc747c9911a1f91f6be0dc17a6d5/IslandGuide/Assets.xcassets/spots/spot2.imageset/spot2.png -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/spots/spot3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "spot3.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/spots/spot3.imageset/spot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hybridcattt/IslandGuideSample/5ec4831030a7cc747c9911a1f91f6be0dc17a6d5/IslandGuide/Assets.xcassets/spots/spot3.imageset/spot3.png -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/spots/spot4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "spot4.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/spots/spot4.imageset/spot4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hybridcattt/IslandGuideSample/5ec4831030a7cc747c9911a1f91f6be0dc17a6d5/IslandGuide/Assets.xcassets/spots/spot4.imageset/spot4.png -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/spots/spot5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "spot5.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/spots/spot5.imageset/spot5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hybridcattt/IslandGuideSample/5ec4831030a7cc747c9911a1f91f6be0dc17a6d5/IslandGuide/Assets.xcassets/spots/spot5.imageset/spot5.png -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/spots/spot6.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "spot6.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/spots/spot6.imageset/spot6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hybridcattt/IslandGuideSample/5ec4831030a7cc747c9911a1f91f6be0dc17a6d5/IslandGuide/Assets.xcassets/spots/spot6.imageset/spot6.png -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/spots/spot7.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "spot7.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /IslandGuide/Assets.xcassets/spots/spot7.imageset/spot7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hybridcattt/IslandGuideSample/5ec4831030a7cc747c9911a1f91f6be0dc17a6d5/IslandGuide/Assets.xcassets/spots/spot7.imageset/spot7.png -------------------------------------------------------------------------------- /IslandGuide/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /IslandGuide/Implementation/Cells/CoolSpotCollectionViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CoolSpotCollectionViewCell.swift 3 | // IslandGuide 4 | // 5 | // Created by Marina Gornostaeva on 29/06/2019. 6 | // Copyright © 2019 SwiftIsland. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class CoolSpotCollectionViewCell: UICollectionViewCell { 12 | 13 | let titleLabel: UILabel = UILabel() 14 | let imageView: UIImageView = UIImageView() 15 | 16 | override init(frame: CGRect) { 17 | super.init(frame: frame) 18 | 19 | self.configureUI() 20 | } 21 | 22 | @available(*, unavailable) 23 | required init?(coder: NSCoder) { 24 | fatalError("init(coder:) has not been implemented") 25 | } 26 | } 27 | 28 | // MARK: - Data - 29 | 30 | extension CoolSpotCollectionViewCell { 31 | 32 | func fillWithData(_ data: Spot) { 33 | titleLabel.text = data.title 34 | imageView.image = UIImage(named: data.imageName) 35 | } 36 | } 37 | 38 | // MARK: - UI - 39 | 40 | private extension CoolSpotCollectionViewCell { 41 | 42 | func configureUI() { 43 | 44 | // Styling 45 | 46 | contentView.layer.cornerRadius = 5 47 | contentView.clipsToBounds = true 48 | 49 | titleLabel.textAlignment = .center 50 | titleLabel.numberOfLines = 2 51 | titleLabel.font = UIFont(descriptor: UIFont.preferredFont(forTextStyle: .title2).fontDescriptor.withSymbolicTraits(.traitBold)!, size: 0) 52 | 53 | titleLabel.textColor = .white 54 | 55 | imageView.contentMode = .scaleAspectFill 56 | imageView.backgroundColor = .systemTeal 57 | 58 | // Layout 59 | 60 | titleLabel.translatesAutoresizingMaskIntoConstraints = false 61 | imageView.translatesAutoresizingMaskIntoConstraints = false 62 | 63 | let container = self.contentView 64 | 65 | container.addSubview(imageView) 66 | container.addSubview(titleLabel) 67 | 68 | titleLabel.leadingAnchor.constraint(equalTo: container.layoutMarginsGuide.leadingAnchor).isActive = true 69 | titleLabel.trailingAnchor.constraint(equalTo: container.layoutMarginsGuide.trailingAnchor).isActive = true 70 | titleLabel.topAnchor.constraint(equalTo: container.layoutMarginsGuide.topAnchor).isActive = true 71 | titleLabel.bottomAnchor.constraint(equalTo: container.layoutMarginsGuide.bottomAnchor).isActive = true 72 | titleLabel.insetsLayoutMarginsFromSafeArea = false 73 | 74 | imageView.leadingAnchor.constraint(equalTo: container.leadingAnchor).isActive = true 75 | imageView.trailingAnchor.constraint(equalTo: container.trailingAnchor).isActive = true 76 | imageView.topAnchor.constraint(equalTo: container.topAnchor).isActive = true 77 | imageView.bottomAnchor.constraint(equalTo: container.bottomAnchor).isActive = true 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /IslandGuide/Implementation/Cells/CuteSealCollectionViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FunActivityCollectionViewCell.swift 3 | // IslandGuide 4 | // 5 | // Created by Marina Gornostaeva on 29/06/2019. 6 | // Copyright © 2019 SwiftIsland. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class CuteSealCollectionViewCell: UICollectionViewCell { 12 | 13 | let titleLabel: UILabel = UILabel() 14 | let imageView: UIImageView = UIImageView() 15 | 16 | override init(frame: CGRect) { 17 | super.init(frame: frame) 18 | 19 | self.configureUI() 20 | } 21 | 22 | @available(*, unavailable) 23 | required init?(coder: NSCoder) { 24 | fatalError("init(coder:) has not been implemented") 25 | } 26 | } 27 | 28 | // MARK: - Data - 29 | 30 | extension CuteSealCollectionViewCell { 31 | 32 | func fillWithData(_ data: Seal) { 33 | titleLabel.text = data.name 34 | imageView.image = UIImage(named: data.imageName) 35 | } 36 | } 37 | 38 | // MARK: - UI - 39 | 40 | private extension CuteSealCollectionViewCell { 41 | 42 | func configureUI() { 43 | 44 | // Styling 45 | 46 | titleLabel.textAlignment = .natural 47 | titleLabel.font = .preferredFont(forTextStyle: .body) 48 | 49 | imageView.contentMode = .scaleAspectFill 50 | imageView.backgroundColor = .systemPink 51 | imageView.layer.cornerRadius = 5 52 | imageView.clipsToBounds = true 53 | imageView.contentMode = .scaleAspectFill 54 | 55 | let stackView = UIStackView(arrangedSubviews: [imageView, titleLabel]) 56 | stackView.axis = .horizontal 57 | stackView.distribution = .fill 58 | stackView.alignment = .center 59 | stackView.spacing = 10 60 | 61 | // Layout 62 | 63 | titleLabel.translatesAutoresizingMaskIntoConstraints = false 64 | imageView.translatesAutoresizingMaskIntoConstraints = false 65 | stackView.translatesAutoresizingMaskIntoConstraints = false 66 | 67 | let container = self.contentView 68 | 69 | container.addSubview(stackView) 70 | 71 | imageView.heightAnchor.constraint(equalTo: imageView.widthAnchor).isActive = true 72 | imageView.heightAnchor.constraint(equalTo: stackView.heightAnchor).isActive = true 73 | 74 | stackView.leadingAnchor.constraint(equalTo: container.leadingAnchor).isActive = true 75 | stackView.trailingAnchor.constraint(equalTo: container.trailingAnchor).isActive = true 76 | stackView.topAnchor.constraint(equalTo: container.topAnchor).isActive = true 77 | stackView.bottomAnchor.constraint(equalTo: container.bottomAnchor).isActive = true 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /IslandGuide/Implementation/Cells/FunActivityCollectionViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FunActivityCollectionViewCell.swift 3 | // IslandGuide 4 | // 5 | // Created by Marina Gornostaeva on 29/06/2019. 6 | // Copyright © 2019 SwiftIsland. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class FunActivityCollectionViewCell: UICollectionViewCell { 12 | 13 | let titleLabel: UILabel = UILabel() 14 | let descriptionLabel: UILabel = UILabel() 15 | 16 | override init(frame: CGRect) { 17 | super.init(frame: frame) 18 | 19 | self.configureUI() 20 | } 21 | 22 | @available(*, unavailable) 23 | required init?(coder: NSCoder) { 24 | fatalError("init(coder:) has not been implemented") 25 | } 26 | } 27 | 28 | // MARK: - Data - 29 | 30 | extension FunActivityCollectionViewCell { 31 | 32 | func fillWithData(_ data: Activity) { 33 | titleLabel.text = data.title 34 | descriptionLabel.text = data.description 35 | } 36 | } 37 | 38 | // MARK: - UI - 39 | 40 | private extension FunActivityCollectionViewCell { 41 | 42 | func configureUI() { 43 | 44 | // Styling 45 | 46 | titleLabel.textAlignment = .natural 47 | titleLabel.font = UIFont(descriptor: UIFont.preferredFont(forTextStyle: .title3).fontDescriptor.withSymbolicTraits(.traitBold)!, size: 0) 48 | titleLabel.textColor = .systemPurple 49 | 50 | descriptionLabel.textAlignment = .natural 51 | descriptionLabel.font = .preferredFont(forTextStyle: .subheadline) 52 | descriptionLabel.numberOfLines = 0 53 | 54 | let stackView = UIStackView(arrangedSubviews: [titleLabel, descriptionLabel]) 55 | stackView.axis = .vertical 56 | stackView.distribution = .fill 57 | stackView.alignment = .fill 58 | stackView.spacing = 5 59 | 60 | // Layout 61 | 62 | titleLabel.translatesAutoresizingMaskIntoConstraints = false 63 | descriptionLabel.translatesAutoresizingMaskIntoConstraints = false 64 | stackView.translatesAutoresizingMaskIntoConstraints = false 65 | 66 | let container = self.contentView 67 | 68 | container.addSubview(stackView) 69 | 70 | stackView.leadingAnchor.constraint(equalTo: container.leadingAnchor).isActive = true 71 | stackView.trailingAnchor.constraint(equalTo: container.trailingAnchor).isActive = true 72 | stackView.topAnchor.constraint(equalTo: container.topAnchor).isActive = true 73 | stackView.bottomAnchor.constraint(lessThanOrEqualTo: container.bottomAnchor).isActive = true 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /IslandGuide/Implementation/Cells/Helper/ReuseIdentifierHelper.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ReuseIdentifierHelper.swift 3 | // IslandGuide 4 | // 5 | // Created by Marina Gornostaeva on 29/06/2019. 6 | // Copyright © 2019 SwiftIsland. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UICollectionView { 12 | 13 | func dequeueCell(ofType: CellType.Type, for indexPath: IndexPath) -> CellType { 14 | 15 | let reuseIdentifier = "\(CellType.self)" 16 | let someCell = self.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) 17 | guard let cell = someCell as? CellType else { 18 | fatalError("Could not dequeue cell of type \(CellType.self)") 19 | } 20 | return cell 21 | } 22 | 23 | func registerCell(ofType: CellType.Type) { 24 | 25 | let reuseIdentifier = "\(CellType.self)" 26 | self.register(CellType.self, forCellWithReuseIdentifier: reuseIdentifier) 27 | } 28 | 29 | func registerReusableView(ofType: ViewType.Type, forKind kind: String) { 30 | 31 | let reuseIdentifier = "\(ViewType.self)" 32 | self.register(ViewType.self, forSupplementaryViewOfKind: kind, withReuseIdentifier: reuseIdentifier) 33 | } 34 | 35 | func dequeueReusableView(ofType: ViewType.Type, forKind kind: String, for indexPath: IndexPath) -> ViewType { 36 | 37 | let reuseIdentifier = "\(ViewType.self)" 38 | let someView = self.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: reuseIdentifier, for: indexPath) 39 | guard let view = someView as? ViewType else { 40 | fatalError("Could not dequeue supplementary view of type \(ViewType.self)") 41 | } 42 | return view 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /IslandGuide/Implementation/Cells/SupplementaryViews.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StarSupplementaryView.swift 3 | // IslandGuide 4 | // 5 | // Created by Marina Gornostaeva on 03/07/2019. 6 | // Copyright © 2019 SwiftIsland. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class StarSupplementaryView: UICollectionReusableView { 12 | 13 | override init(frame: CGRect) { 14 | super.init(frame: frame) 15 | 16 | self.configureUI() 17 | } 18 | 19 | @available(*, unavailable) 20 | required init?(coder: NSCoder) { 21 | fatalError("init(coder:) has not been implemented") 22 | } 23 | 24 | func configureUI() { 25 | let imageView = UIImageView(image: UIImage(systemName: "star.circle")) 26 | addSubview(imageView) 27 | imageView.frame = bounds 28 | imageView.autoresizingMask = [.flexibleWidth, .flexibleHeight] 29 | 30 | imageView.tintColor = .systemYellow 31 | } 32 | } 33 | 34 | class CheckmarkSupplementaryView: UICollectionReusableView { 35 | 36 | override init(frame: CGRect) { 37 | super.init(frame: frame) 38 | 39 | self.configureUI() 40 | } 41 | 42 | @available(*, unavailable) 43 | required init?(coder: NSCoder) { 44 | fatalError("init(coder:) has not been implemented") 45 | } 46 | 47 | func configureUI() { 48 | let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle")) 49 | addSubview(imageView) 50 | imageView.frame = bounds 51 | imageView.autoresizingMask = [.flexibleWidth, .flexibleHeight] 52 | 53 | imageView.tintColor = .systemPink 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /IslandGuide/Implementation/Data/AppData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StaticAppData.swift 3 | // IslandGuide 4 | // 5 | // Created by Marina Gornostaeva on 29/06/2019. 6 | // Copyright © 2019 SwiftIsland. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct AppData { 12 | 13 | var coolSpots: [Spot] = { 14 | return [ 15 | Spot(title: "The Lighthouse", imageName: "spot4"), 16 | Spot(title: "Prince Hendrik", imageName: "spot6"), 17 | Spot(title: "Seal sanctuary", imageName: "spot5"), 18 | Spot(title: "The Bollekamer", imageName: "spot2"), 19 | Spot(title: "Beach Pavilion Twaalf", imageName: "spot3"), 20 | Spot(title: "Sommeltjespad", imageName: "spot1"), 21 | Spot(title: "The Lighthouse", imageName: "spot4"), 22 | Spot(title: "Prince Hendrik", imageName: "spot6"), 23 | Spot(title: "Seal sanctuary", imageName: "spot5"), 24 | ] 25 | }() 26 | 27 | var funActivities: [Activity] = { 28 | return [ 29 | Activity(title: "Biking", 30 | description: "Biking is the best activity you can find. It's fun, it's sporty, and you can look kind of cool on a bike"), 31 | Activity(title: "SwiftIsland", 32 | description: "This is a special one...."), 33 | Activity(title: "Running around", 34 | description: "Running is not for everyone. But if it's for you, you're in luck! It's still slow enough so you can look around at the nature around"), 35 | Activity(title: "Petting the seals", 36 | description: "Do you dare to do it? Is it even dangerous? Let's find out together!"), 37 | Activity(title: "Biking", 38 | description: "Biking is the best activity you can find. It's fun, it's sporty, and you can look kind of cool on a bike"), 39 | Activity(title: "Running around", 40 | description: "Running is not for everyone. But if it's for you, you're in luck! It's still slow enough so you can look around at the nature around"), 41 | Activity(title: "SwiftIsland", 42 | description: "This is a special one...."), 43 | Activity(title: "Biking", 44 | description: "Biking is the best activity you can find. It's fun, it's sporty, and you can look kind of cool on a bike"), 45 | ] 46 | }() 47 | 48 | var cuteSeals: [Seal] = { 49 | return [ 50 | Seal(name: "Dorothy", imageName: "seal1"), 51 | Seal(name: "Bob", imageName: "seal2"), 52 | Seal(name: "Robby", imageName: "seal3"), 53 | Seal(name: "Narnia", imageName: "seal4"), 54 | Seal(name: "Mary", imageName: "seal5"), 55 | Seal(name: "Kesha", imageName: "seal1"), 56 | Seal(name: "J. Doe", imageName: "seal4"), 57 | Seal(name: "Ada", imageName: "seal2"), 58 | Seal(name: "Sheldon", imageName: "seal3"), 59 | Seal(name: "Mary", imageName: "seal5"), 60 | Seal(name: "Kesha", imageName: "seal1"), 61 | Seal(name: "J. Doe", imageName: "seal4"), 62 | Seal(name: "Ada", imageName: "seal2"), 63 | Seal(name: "Sheldon", imageName: "seal3"), 64 | ] 65 | }() 66 | } 67 | -------------------------------------------------------------------------------- /IslandGuide/Implementation/Data/DataModels.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DataModels.swift 3 | // IslandGuide 4 | // 5 | // Created by Marina Gornostaeva on 29/06/2019. 6 | // Copyright © 2019 SwiftIsland. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct Spot: Hashable { 12 | let id: UUID = UUID() 13 | let title: String 14 | let imageName: String 15 | } 16 | 17 | struct Activity: Hashable { 18 | let id: UUID = UUID() 19 | let title: String 20 | let description: String 21 | } 22 | 23 | struct Seal: Hashable { 24 | let id: UUID = UUID() 25 | let name: String 26 | let imageName: String 27 | } 28 | -------------------------------------------------------------------------------- /IslandGuide/Implementation/ViewControllers/GuideViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GuideViewController.swift 3 | // IslandGuide 4 | // 5 | // Created by Marina Gornostaeva on 29/06/2019. 6 | // Copyright © 2019 SwiftIsland. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | // MARK: - View Controller Lifecycle - 12 | 13 | class GuideViewController: UIViewController { 14 | 15 | enum GuideSection: CaseIterable { 16 | case coolSpots 17 | case funActivities 18 | case cuteSeals 19 | } 20 | 21 | enum GuideItem: Hashable { 22 | case coolSpot(Spot) 23 | case funActivity(Activity) 24 | case cuteSeal(Seal) 25 | } 26 | 27 | private(set) var collectionView: UICollectionView! 28 | private(set) var dataSource: UICollectionViewDiffableDataSource! // retain data source! 29 | 30 | private(set) var appData: AppData = AppData() 31 | 32 | private var showActivities: Bool = true 33 | private var shownSections: [GuideSection] = [] 34 | 35 | override func viewDidLoad() { 36 | super.viewDidLoad() 37 | 38 | configureNavigationBar() 39 | 40 | addCollectionView() 41 | configureCollectionView() 42 | } 43 | 44 | @objc private func shuffleButtonPressed(_ sender: Any) { 45 | appData.cuteSeals.shuffle() 46 | updateSnapshot() 47 | } 48 | 49 | @objc private func aButtonPressed(_ sender: Any) { 50 | showActivities.toggle() 51 | updateSnapshot() 52 | } 53 | } 54 | 55 | // MARK: - Collection View DataSource - 56 | 57 | private extension GuideViewController { 58 | 59 | func configureDiffableDataSource() { 60 | 61 | let dataSource = UICollectionViewDiffableDataSource(collectionView: collectionView) { (collectionView: UICollectionView, indexPath: IndexPath, item: GuideItem) -> UICollectionViewCell? in 62 | 63 | switch item { 64 | case .coolSpot(let spot): 65 | let cell = collectionView.dequeueCell(ofType: CoolSpotCollectionViewCell.self, for: indexPath) 66 | cell.fillWithData(spot) 67 | return cell 68 | 69 | case .funActivity(let activity): 70 | let cell = collectionView.dequeueCell(ofType: FunActivityCollectionViewCell.self, for: indexPath) 71 | cell.fillWithData(activity) 72 | return cell 73 | 74 | case .cuteSeal(let seal): 75 | let cell = collectionView.dequeueCell(ofType: CuteSealCollectionViewCell.self, for: indexPath) 76 | cell.fillWithData(seal) 77 | return cell 78 | } 79 | } 80 | 81 | self.dataSource = dataSource 82 | 83 | updateSnapshot(animated: false) 84 | } 85 | 86 | func updateSnapshot(animated: Bool = true) { 87 | 88 | var snapshot = NSDiffableDataSourceSnapshot() 89 | 90 | snapshot.appendSections([.coolSpots]) 91 | snapshot.appendItems(appData.coolSpots.map({ GuideItem.coolSpot($0) })) 92 | 93 | if showActivities { 94 | snapshot.appendSections([.funActivities]) 95 | snapshot.appendItems(appData.funActivities.map({ GuideItem.funActivity($0) })) 96 | } 97 | 98 | snapshot.appendSections([.cuteSeals]) 99 | snapshot.appendItems(appData.cuteSeals.map({ GuideItem.cuteSeal($0) })) 100 | 101 | shownSections = snapshot.sectionIdentifiers 102 | 103 | dataSource.apply(snapshot, animatingDifferences: animated) 104 | } 105 | } 106 | 107 | // MARK: - Collection View Layout - 108 | 109 | private extension GuideViewController { 110 | 111 | func makeCompositionalLayout() -> UICollectionViewLayout { 112 | let configuration = UICollectionViewCompositionalLayoutConfiguration() 113 | configuration.interSectionSpacing = 20 114 | 115 | let layout = UICollectionViewCompositionalLayout(sectionProvider: { [weak self] (sectionIndex: Int, environment: NSCollectionLayoutEnvironment) -> NSCollectionLayoutSection? in 116 | 117 | guard let sself = self else { 118 | return nil 119 | } 120 | 121 | let guideSection = sself.shownSections[sectionIndex] 122 | 123 | let section: NSCollectionLayoutSection 124 | switch guideSection { 125 | case .coolSpots: 126 | section = sself.makeSpotsSectionDeclaration() 127 | case .funActivities: 128 | section = sself.makeActivitiesSectionDeclaration() 129 | case .cuteSeals: 130 | section = sself.makeSealsSectionDeclaration(environment: environment) 131 | } 132 | 133 | section.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 10, bottom: 0, trailing: 10) 134 | return section 135 | 136 | }, configuration: configuration) 137 | 138 | return layout 139 | } 140 | 141 | func makeSpotsSectionDeclaration() -> NSCollectionLayoutSection { 142 | 143 | let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), 144 | heightDimension: .fractionalHeight(1.0)) 145 | let item = NSCollectionLayoutItem(layoutSize: itemSize) 146 | 147 | let largeItemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.4), 148 | heightDimension: .fractionalHeight(1.0)) 149 | let largeItem = NSCollectionLayoutItem(layoutSize: largeItemSize) 150 | 151 | let groupOf2Size = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.58), 152 | heightDimension: .fractionalHeight(1.0)) 153 | let groupOf2 = NSCollectionLayoutGroup.vertical(layoutSize: groupOf2Size, subitem: item, count: 2) 154 | groupOf2.interItemSpacing = .fixed(10) 155 | 156 | let groupOf3Size = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), 157 | heightDimension: .fractionalHeight(1.0)) 158 | let groupOf3 = NSCollectionLayoutGroup.horizontal(layoutSize: groupOf3Size, subitems: [largeItem, groupOf2]) 159 | groupOf3.interItemSpacing = .flexible(0) 160 | 161 | let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.8), 162 | heightDimension: .absolute(200)) 163 | let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitem: groupOf3, count: 1) 164 | 165 | group.interItemSpacing = NSCollectionLayoutSpacing.fixed(10) 166 | 167 | let section = NSCollectionLayoutSection(group: group) 168 | section.interGroupSpacing = 10 169 | section.orthogonalScrollingBehavior = .groupPagingCentered 170 | 171 | return section 172 | } 173 | 174 | func makeActivitiesSectionDeclaration() -> NSCollectionLayoutSection { 175 | 176 | let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), 177 | heightDimension: .estimated(40)) 178 | let item = NSCollectionLayoutItem(layoutSize: itemSize) 179 | 180 | let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), 181 | heightDimension: .estimated(100)) // this value doesn't matter 182 | let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item]) 183 | 184 | group.interItemSpacing = NSCollectionLayoutSpacing.fixed(10) 185 | 186 | let section = NSCollectionLayoutSection(group: group) 187 | section.interGroupSpacing = 10 188 | 189 | return section 190 | } 191 | 192 | func makeSealsSectionDeclaration(environment: NSCollectionLayoutEnvironment) -> NSCollectionLayoutSection { 193 | 194 | let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), 195 | heightDimension: .fractionalHeight(1.0)) 196 | let item = NSCollectionLayoutItem(layoutSize: itemSize) 197 | 198 | let width: CGFloat = environment.traitCollection.horizontalSizeClass == .compact ? 150 : 250 199 | 200 | let groupSize = NSCollectionLayoutSize(widthDimension: .absolute(width), 201 | heightDimension: .absolute(200)) 202 | let group = NSCollectionLayoutGroup.vertical(layoutSize: groupSize, subitem: item, count: 3) 203 | 204 | group.interItemSpacing = NSCollectionLayoutSpacing.fixed(10) 205 | 206 | let section = NSCollectionLayoutSection(group: group) 207 | section.interGroupSpacing = 10 208 | 209 | section.orthogonalScrollingBehavior = .continuousGroupLeadingBoundary 210 | 211 | return section 212 | } 213 | } 214 | 215 | // MARK: - Collection View Delegate - 216 | 217 | extension GuideViewController: UICollectionViewDelegate { 218 | 219 | func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) { 220 | cell.contentView.backgroundColor = UIColor.systemGray6 221 | } 222 | 223 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { 224 | collectionView.deselectItem(at: indexPath, animated: false) 225 | } 226 | } 227 | 228 | // MARK: - Basic UI - 229 | 230 | private extension GuideViewController { 231 | 232 | func addCollectionView() { 233 | 234 | let layout = makeCompositionalLayout() 235 | 236 | collectionView = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout) 237 | collectionView.backgroundColor = .systemBackground 238 | collectionView.translatesAutoresizingMaskIntoConstraints = false 239 | collectionView.alwaysBounceVertical = true 240 | collectionView.contentInset.top = 20 241 | 242 | view.addSubview(collectionView) 243 | 244 | collectionView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true 245 | collectionView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true 246 | collectionView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true 247 | collectionView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true 248 | } 249 | 250 | func configureCollectionView() { 251 | 252 | collectionView.registerCell(ofType: CoolSpotCollectionViewCell.self) 253 | collectionView.registerCell(ofType: FunActivityCollectionViewCell.self) 254 | collectionView.registerCell(ofType: CuteSealCollectionViewCell.self) 255 | 256 | collectionView.delegate = self // Set delegate before data source !! 257 | configureDiffableDataSource() 258 | } 259 | 260 | func configureNavigationBar() { 261 | title = "Island Guide" 262 | navigationItem.largeTitleDisplayMode = .always 263 | let shuffle = UIBarButtonItem(image: UIImage(systemName: "shuffle"), style: .plain, target: self, action: #selector(shuffleButtonPressed(_:))) 264 | let toggleActivities = UIBarButtonItem(image: UIImage(systemName: "a.circle"), style: .plain, target: self, action: #selector(aButtonPressed(_:))) 265 | navigationItem.rightBarButtonItems = [shuffle, toggleActivities] 266 | } 267 | } 268 | -------------------------------------------------------------------------------- /IslandGuide/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 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /IslandGuideTests/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 | -------------------------------------------------------------------------------- /IslandGuideTests/IslandGuideTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IslandGuideTests.swift 3 | // IslandGuideTests 4 | // 5 | // Created by Marina Gornostaeva on 29/06/2019. 6 | // Copyright © 2019 SwiftIsland. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import IslandGuide 11 | 12 | class IslandGuideTests: XCTestCase { 13 | 14 | override func setUp() { 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | } 21 | 22 | func testExample() { 23 | // This is an example of a functional test case. 24 | // Use XCTAssert and related functions to verify your tests produce the correct results. 25 | } 26 | 27 | func testPerformanceExample() { 28 | // This is an example of a performance test case. 29 | self.measure { 30 | // Put the code you want to measure the time of here. 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Marina 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IslandGuideSample 2 | 3 | This app was originally created as a demo app for a workshop that I instructed in 2019. 4 | 5 | These days this project is a fully working example of `UICompositionalCollectionViewLayout` 6 | and `NSDiffableDataSource` powering a dynamic multi-section collection view. 7 | 8 | I keep referring to this project myself whenever I want to remember how to get the full setup going, 9 | or if I hit an obscure bug that shouldn't be happening. 10 | 11 | Feel free to fork the project and make your own changes. 12 | If you notice a bug or just code that can be improved, PRs are welcome 💛 13 | 14 | ## About 15 | 16 | Demo app for Collection Views workshop @ [Swift Island 2019](https://swiftisland.nl). Slides: [SpeakerDeck](https://speakerdeck.com/hybridcattt/collection-views-diffable-data-sources-and-compositional-layout-workshop-at-swiftisland-2019). 17 | 18 | Created by [Marina Gornostaeva](https://twitter.com/hybridcattt). 19 | 20 | ![the demo](demo.gif) 21 | 22 | During the workshop we went through refactoring of this app from using 23 | classic `UICollectionViewDataSource` and `UICollectionViewFlowLayout` 24 | to using the new diffable data source and compositional layout. 25 | 26 | The steps below can be checked out from separate branches in this repo. 27 | 28 | ### Part 1: Diffable Data Source 29 | 30 | 1. Simple data source 31 | 2. Creating and updating data in different ways 32 | 33 | ### Part 2: Compositional layout 34 | 35 | 3. Basic concepts of compositional layout 36 | 4. Trying out nested groups and using estimated height 37 | 38 | ### Optional excercises 39 | 40 | - Different layout for different size classes 41 | - Section inset based on system layout margins 42 | - Supplementary views, headers 43 | 44 | ## After the workshop 45 | 46 | WWDC 2019 has two great sessions that go in depth into the new compositional layout and diffable data source. 47 | 48 | [Advances in Collection View Layout](https://developer.apple.com/videos/play/wwdc2019/215/) 49 | 50 | [Advances in UI Data Sources](https://developer.apple.com/videos/play/wwdc2019/220) 51 | -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hybridcattt/IslandGuideSample/5ec4831030a7cc747c9911a1f91f6be0dc17a6d5/demo.gif --------------------------------------------------------------------------------