├── .gitignore ├── Grid ├── Objc │ ├── GridViewExample.xcodeproj │ │ └── project.pbxproj │ ├── GridViewExample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── Info.plist │ │ ├── MainCollectionViewCell.h │ │ ├── MainCollectionViewCell.m │ │ ├── MainGridController.h │ │ ├── MainGridController.m │ │ ├── ViewController.h │ │ ├── ViewController.m │ │ └── main.m │ └── Podfile └── Swift │ ├── GridViewExample.xcodeproj │ └── project.pbxproj │ ├── GridViewExample │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── MainCollectionViewCell.swift │ └── MainGridController.swift │ └── Podfile ├── LICENSE ├── Map └── Swift │ ├── MapViewExample.xcodeproj │ └── project.pbxproj │ ├── MapViewExample │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift │ └── Podfile └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | .DS_Store 20 | Podfile.lock 21 | Pods 22 | xcshareddata 23 | *.xcworkspace 24 | 25 | # CocoaPods 26 | # 27 | # We recommend against adding the Pods directory to your .gitignore. However 28 | # you should judge for yourself, the pros and cons are mentioned at: 29 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 30 | # 31 | #Pods/ 32 | -------------------------------------------------------------------------------- /Grid/Objc/GridViewExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A0D486D61BE02918001FE79D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A0D486D51BE02918001FE79D /* main.m */; }; 11 | A0D486D91BE02918001FE79D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A0D486D81BE02918001FE79D /* AppDelegate.m */; }; 12 | A0D486DC1BE02918001FE79D /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A0D486DB1BE02918001FE79D /* ViewController.m */; }; 13 | A0D486DF1BE02918001FE79D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A0D486DD1BE02918001FE79D /* Main.storyboard */; }; 14 | A0D486E11BE02918001FE79D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A0D486E01BE02918001FE79D /* Assets.xcassets */; }; 15 | A0D486E41BE02918001FE79D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A0D486E21BE02918001FE79D /* LaunchScreen.storyboard */; }; 16 | A0D486F01BE029F4001FE79D /* MainGridController.m in Sources */ = {isa = PBXBuildFile; fileRef = A0D486EF1BE029F4001FE79D /* MainGridController.m */; }; 17 | A0D486F31BE02F2A001FE79D /* MainCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A0D486F21BE02F2A001FE79D /* MainCollectionViewCell.m */; }; 18 | AB2E5D66CEB22CC21D6B7578 /* libPods-GridViewExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C5B223CD6980C653420141B7 /* libPods-GridViewExample.a */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | 4AC2EF8D1D02E6ADEE06AF05 /* Pods-GridViewExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GridViewExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-GridViewExample/Pods-GridViewExample.release.xcconfig"; sourceTree = ""; }; 23 | 9B02F63550CBC22BE8A69EFD /* Pods-GridViewExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GridViewExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GridViewExample/Pods-GridViewExample.debug.xcconfig"; sourceTree = ""; }; 24 | A0D486D11BE02918001FE79D /* GridViewExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GridViewExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 25 | A0D486D51BE02918001FE79D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 26 | A0D486D71BE02918001FE79D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 27 | A0D486D81BE02918001FE79D /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 28 | A0D486DA1BE02918001FE79D /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 29 | A0D486DB1BE02918001FE79D /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 30 | A0D486DE1BE02918001FE79D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 31 | A0D486E01BE02918001FE79D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 32 | A0D486E31BE02918001FE79D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 33 | A0D486E51BE02918001FE79D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | A0D486EE1BE029F4001FE79D /* MainGridController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainGridController.h; sourceTree = ""; }; 35 | A0D486EF1BE029F4001FE79D /* MainGridController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainGridController.m; sourceTree = ""; }; 36 | A0D486F11BE02F2A001FE79D /* MainCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainCollectionViewCell.h; sourceTree = ""; }; 37 | A0D486F21BE02F2A001FE79D /* MainCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainCollectionViewCell.m; sourceTree = ""; }; 38 | C5B223CD6980C653420141B7 /* libPods-GridViewExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-GridViewExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | /* End PBXFileReference section */ 40 | 41 | /* Begin PBXFrameworksBuildPhase section */ 42 | A0D486CE1BE02918001FE79D /* Frameworks */ = { 43 | isa = PBXFrameworksBuildPhase; 44 | buildActionMask = 2147483647; 45 | files = ( 46 | AB2E5D66CEB22CC21D6B7578 /* libPods-GridViewExample.a in Frameworks */, 47 | ); 48 | runOnlyForDeploymentPostprocessing = 0; 49 | }; 50 | /* End PBXFrameworksBuildPhase section */ 51 | 52 | /* Begin PBXGroup section */ 53 | 464578F809936950A4AA56AD /* Pods */ = { 54 | isa = PBXGroup; 55 | children = ( 56 | 9B02F63550CBC22BE8A69EFD /* Pods-GridViewExample.debug.xcconfig */, 57 | 4AC2EF8D1D02E6ADEE06AF05 /* Pods-GridViewExample.release.xcconfig */, 58 | ); 59 | name = Pods; 60 | sourceTree = ""; 61 | }; 62 | 646355359FB8428BD0B77334 /* Frameworks */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | C5B223CD6980C653420141B7 /* libPods-GridViewExample.a */, 66 | ); 67 | name = Frameworks; 68 | sourceTree = ""; 69 | }; 70 | A0D486C81BE02918001FE79D = { 71 | isa = PBXGroup; 72 | children = ( 73 | A0D486D31BE02918001FE79D /* GridViewExample */, 74 | A0D486D21BE02918001FE79D /* Products */, 75 | 464578F809936950A4AA56AD /* Pods */, 76 | 646355359FB8428BD0B77334 /* Frameworks */, 77 | ); 78 | sourceTree = ""; 79 | }; 80 | A0D486D21BE02918001FE79D /* Products */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | A0D486D11BE02918001FE79D /* GridViewExample.app */, 84 | ); 85 | name = Products; 86 | sourceTree = ""; 87 | }; 88 | A0D486D31BE02918001FE79D /* GridViewExample */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | A0D486D71BE02918001FE79D /* AppDelegate.h */, 92 | A0D486D81BE02918001FE79D /* AppDelegate.m */, 93 | A0D486DA1BE02918001FE79D /* ViewController.h */, 94 | A0D486DB1BE02918001FE79D /* ViewController.m */, 95 | A0D486EE1BE029F4001FE79D /* MainGridController.h */, 96 | A0D486EF1BE029F4001FE79D /* MainGridController.m */, 97 | A0D486F11BE02F2A001FE79D /* MainCollectionViewCell.h */, 98 | A0D486F21BE02F2A001FE79D /* MainCollectionViewCell.m */, 99 | A0D486DD1BE02918001FE79D /* Main.storyboard */, 100 | A0D486E01BE02918001FE79D /* Assets.xcassets */, 101 | A0D486E21BE02918001FE79D /* LaunchScreen.storyboard */, 102 | A0D486E51BE02918001FE79D /* Info.plist */, 103 | A0D486D41BE02918001FE79D /* Supporting Files */, 104 | ); 105 | path = GridViewExample; 106 | sourceTree = ""; 107 | }; 108 | A0D486D41BE02918001FE79D /* Supporting Files */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | A0D486D51BE02918001FE79D /* main.m */, 112 | ); 113 | name = "Supporting Files"; 114 | sourceTree = ""; 115 | }; 116 | /* End PBXGroup section */ 117 | 118 | /* Begin PBXNativeTarget section */ 119 | A0D486D01BE02918001FE79D /* GridViewExample */ = { 120 | isa = PBXNativeTarget; 121 | buildConfigurationList = A0D486E81BE02918001FE79D /* Build configuration list for PBXNativeTarget "GridViewExample" */; 122 | buildPhases = ( 123 | 762068D9F07C0970D00F35D7 /* Check Pods Manifest.lock */, 124 | A0D486CD1BE02918001FE79D /* Sources */, 125 | A0D486CE1BE02918001FE79D /* Frameworks */, 126 | A0D486CF1BE02918001FE79D /* Resources */, 127 | 7F35A626168EB2D020818F92 /* Embed Pods Frameworks */, 128 | 96C9F54C07F187F474BB9214 /* Copy Pods Resources */, 129 | ); 130 | buildRules = ( 131 | ); 132 | dependencies = ( 133 | ); 134 | name = GridViewExample; 135 | productName = GridViewExample; 136 | productReference = A0D486D11BE02918001FE79D /* GridViewExample.app */; 137 | productType = "com.apple.product-type.application"; 138 | }; 139 | /* End PBXNativeTarget section */ 140 | 141 | /* Begin PBXProject section */ 142 | A0D486C91BE02918001FE79D /* Project object */ = { 143 | isa = PBXProject; 144 | attributes = { 145 | LastUpgradeCheck = 0710; 146 | ORGANIZATIONNAME = "Adam Fish"; 147 | TargetAttributes = { 148 | A0D486D01BE02918001FE79D = { 149 | CreatedOnToolsVersion = 7.1; 150 | }; 151 | }; 152 | }; 153 | buildConfigurationList = A0D486CC1BE02918001FE79D /* Build configuration list for PBXProject "GridViewExample" */; 154 | compatibilityVersion = "Xcode 3.2"; 155 | developmentRegion = English; 156 | hasScannedForEncodings = 0; 157 | knownRegions = ( 158 | en, 159 | Base, 160 | ); 161 | mainGroup = A0D486C81BE02918001FE79D; 162 | productRefGroup = A0D486D21BE02918001FE79D /* Products */; 163 | projectDirPath = ""; 164 | projectRoot = ""; 165 | targets = ( 166 | A0D486D01BE02918001FE79D /* GridViewExample */, 167 | ); 168 | }; 169 | /* End PBXProject section */ 170 | 171 | /* Begin PBXResourcesBuildPhase section */ 172 | A0D486CF1BE02918001FE79D /* Resources */ = { 173 | isa = PBXResourcesBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | A0D486E41BE02918001FE79D /* LaunchScreen.storyboard in Resources */, 177 | A0D486E11BE02918001FE79D /* Assets.xcassets in Resources */, 178 | A0D486DF1BE02918001FE79D /* Main.storyboard in Resources */, 179 | ); 180 | runOnlyForDeploymentPostprocessing = 0; 181 | }; 182 | /* End PBXResourcesBuildPhase section */ 183 | 184 | /* Begin PBXShellScriptBuildPhase section */ 185 | 762068D9F07C0970D00F35D7 /* Check Pods Manifest.lock */ = { 186 | isa = PBXShellScriptBuildPhase; 187 | buildActionMask = 2147483647; 188 | files = ( 189 | ); 190 | inputPaths = ( 191 | ); 192 | name = "Check Pods Manifest.lock"; 193 | outputPaths = ( 194 | ); 195 | runOnlyForDeploymentPostprocessing = 0; 196 | shellPath = /bin/sh; 197 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 198 | showEnvVarsInLog = 0; 199 | }; 200 | 7F35A626168EB2D020818F92 /* Embed Pods Frameworks */ = { 201 | isa = PBXShellScriptBuildPhase; 202 | buildActionMask = 2147483647; 203 | files = ( 204 | ); 205 | inputPaths = ( 206 | ); 207 | name = "Embed Pods Frameworks"; 208 | outputPaths = ( 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | shellPath = /bin/sh; 212 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GridViewExample/Pods-GridViewExample-frameworks.sh\"\n"; 213 | showEnvVarsInLog = 0; 214 | }; 215 | 96C9F54C07F187F474BB9214 /* Copy Pods Resources */ = { 216 | isa = PBXShellScriptBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | ); 220 | inputPaths = ( 221 | ); 222 | name = "Copy Pods Resources"; 223 | outputPaths = ( 224 | ); 225 | runOnlyForDeploymentPostprocessing = 0; 226 | shellPath = /bin/sh; 227 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GridViewExample/Pods-GridViewExample-resources.sh\"\n"; 228 | showEnvVarsInLog = 0; 229 | }; 230 | /* End PBXShellScriptBuildPhase section */ 231 | 232 | /* Begin PBXSourcesBuildPhase section */ 233 | A0D486CD1BE02918001FE79D /* Sources */ = { 234 | isa = PBXSourcesBuildPhase; 235 | buildActionMask = 2147483647; 236 | files = ( 237 | A0D486DC1BE02918001FE79D /* ViewController.m in Sources */, 238 | A0D486D91BE02918001FE79D /* AppDelegate.m in Sources */, 239 | A0D486F31BE02F2A001FE79D /* MainCollectionViewCell.m in Sources */, 240 | A0D486F01BE029F4001FE79D /* MainGridController.m in Sources */, 241 | A0D486D61BE02918001FE79D /* main.m in Sources */, 242 | ); 243 | runOnlyForDeploymentPostprocessing = 0; 244 | }; 245 | /* End PBXSourcesBuildPhase section */ 246 | 247 | /* Begin PBXVariantGroup section */ 248 | A0D486DD1BE02918001FE79D /* Main.storyboard */ = { 249 | isa = PBXVariantGroup; 250 | children = ( 251 | A0D486DE1BE02918001FE79D /* Base */, 252 | ); 253 | name = Main.storyboard; 254 | sourceTree = ""; 255 | }; 256 | A0D486E21BE02918001FE79D /* LaunchScreen.storyboard */ = { 257 | isa = PBXVariantGroup; 258 | children = ( 259 | A0D486E31BE02918001FE79D /* Base */, 260 | ); 261 | name = LaunchScreen.storyboard; 262 | sourceTree = ""; 263 | }; 264 | /* End PBXVariantGroup section */ 265 | 266 | /* Begin XCBuildConfiguration section */ 267 | A0D486E61BE02918001FE79D /* Debug */ = { 268 | isa = XCBuildConfiguration; 269 | buildSettings = { 270 | ALWAYS_SEARCH_USER_PATHS = NO; 271 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 272 | CLANG_CXX_LIBRARY = "libc++"; 273 | CLANG_ENABLE_MODULES = YES; 274 | CLANG_ENABLE_OBJC_ARC = YES; 275 | CLANG_WARN_BOOL_CONVERSION = YES; 276 | CLANG_WARN_CONSTANT_CONVERSION = YES; 277 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 278 | CLANG_WARN_EMPTY_BODY = YES; 279 | CLANG_WARN_ENUM_CONVERSION = YES; 280 | CLANG_WARN_INT_CONVERSION = YES; 281 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 282 | CLANG_WARN_UNREACHABLE_CODE = YES; 283 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 284 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 285 | COPY_PHASE_STRIP = NO; 286 | DEBUG_INFORMATION_FORMAT = dwarf; 287 | ENABLE_STRICT_OBJC_MSGSEND = YES; 288 | ENABLE_TESTABILITY = YES; 289 | GCC_C_LANGUAGE_STANDARD = gnu99; 290 | GCC_DYNAMIC_NO_PIC = NO; 291 | GCC_NO_COMMON_BLOCKS = YES; 292 | GCC_OPTIMIZATION_LEVEL = 0; 293 | GCC_PREPROCESSOR_DEFINITIONS = ( 294 | "DEBUG=1", 295 | "$(inherited)", 296 | ); 297 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 298 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 299 | GCC_WARN_UNDECLARED_SELECTOR = YES; 300 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 301 | GCC_WARN_UNUSED_FUNCTION = YES; 302 | GCC_WARN_UNUSED_VARIABLE = YES; 303 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 304 | MTL_ENABLE_DEBUG_INFO = YES; 305 | ONLY_ACTIVE_ARCH = YES; 306 | SDKROOT = iphoneos; 307 | TARGETED_DEVICE_FAMILY = "1,2"; 308 | }; 309 | name = Debug; 310 | }; 311 | A0D486E71BE02918001FE79D /* Release */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | ALWAYS_SEARCH_USER_PATHS = NO; 315 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 316 | CLANG_CXX_LIBRARY = "libc++"; 317 | CLANG_ENABLE_MODULES = YES; 318 | CLANG_ENABLE_OBJC_ARC = YES; 319 | CLANG_WARN_BOOL_CONVERSION = YES; 320 | CLANG_WARN_CONSTANT_CONVERSION = YES; 321 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 322 | CLANG_WARN_EMPTY_BODY = YES; 323 | CLANG_WARN_ENUM_CONVERSION = YES; 324 | CLANG_WARN_INT_CONVERSION = YES; 325 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 326 | CLANG_WARN_UNREACHABLE_CODE = YES; 327 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 328 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 329 | COPY_PHASE_STRIP = NO; 330 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 331 | ENABLE_NS_ASSERTIONS = NO; 332 | ENABLE_STRICT_OBJC_MSGSEND = YES; 333 | GCC_C_LANGUAGE_STANDARD = gnu99; 334 | GCC_NO_COMMON_BLOCKS = YES; 335 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 336 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 337 | GCC_WARN_UNDECLARED_SELECTOR = YES; 338 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 339 | GCC_WARN_UNUSED_FUNCTION = YES; 340 | GCC_WARN_UNUSED_VARIABLE = YES; 341 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 342 | MTL_ENABLE_DEBUG_INFO = NO; 343 | SDKROOT = iphoneos; 344 | TARGETED_DEVICE_FAMILY = "1,2"; 345 | VALIDATE_PRODUCT = YES; 346 | }; 347 | name = Release; 348 | }; 349 | A0D486E91BE02918001FE79D /* Debug */ = { 350 | isa = XCBuildConfiguration; 351 | baseConfigurationReference = 9B02F63550CBC22BE8A69EFD /* Pods-GridViewExample.debug.xcconfig */; 352 | buildSettings = { 353 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 354 | INFOPLIST_FILE = GridViewExample/Info.plist; 355 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 356 | PRODUCT_BUNDLE_IDENTIFIER = com.Realm.GridViewExample; 357 | PRODUCT_NAME = "$(TARGET_NAME)"; 358 | }; 359 | name = Debug; 360 | }; 361 | A0D486EA1BE02918001FE79D /* Release */ = { 362 | isa = XCBuildConfiguration; 363 | baseConfigurationReference = 4AC2EF8D1D02E6ADEE06AF05 /* Pods-GridViewExample.release.xcconfig */; 364 | buildSettings = { 365 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 366 | INFOPLIST_FILE = GridViewExample/Info.plist; 367 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 368 | PRODUCT_BUNDLE_IDENTIFIER = com.Realm.GridViewExample; 369 | PRODUCT_NAME = "$(TARGET_NAME)"; 370 | }; 371 | name = Release; 372 | }; 373 | /* End XCBuildConfiguration section */ 374 | 375 | /* Begin XCConfigurationList section */ 376 | A0D486CC1BE02918001FE79D /* Build configuration list for PBXProject "GridViewExample" */ = { 377 | isa = XCConfigurationList; 378 | buildConfigurations = ( 379 | A0D486E61BE02918001FE79D /* Debug */, 380 | A0D486E71BE02918001FE79D /* Release */, 381 | ); 382 | defaultConfigurationIsVisible = 0; 383 | defaultConfigurationName = Release; 384 | }; 385 | A0D486E81BE02918001FE79D /* Build configuration list for PBXNativeTarget "GridViewExample" */ = { 386 | isa = XCConfigurationList; 387 | buildConfigurations = ( 388 | A0D486E91BE02918001FE79D /* Debug */, 389 | A0D486EA1BE02918001FE79D /* Release */, 390 | ); 391 | defaultConfigurationIsVisible = 0; 392 | defaultConfigurationName = Release; 393 | }; 394 | /* End XCConfigurationList section */ 395 | }; 396 | rootObject = A0D486C91BE02918001FE79D /* Project object */; 397 | } 398 | -------------------------------------------------------------------------------- /Grid/Objc/GridViewExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // GridViewExample 4 | // 5 | // Created by Adam Fish on 10/27/15. 6 | // Copyright © 2015 Adam Fish. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Grid/Objc/GridViewExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // GridViewExample 4 | // 5 | // Created by Adam Fish on 10/27/15. 6 | // Copyright © 2015 Adam Fish. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Grid/Objc/GridViewExample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Grid/Objc/GridViewExample/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 | 27 | 28 | -------------------------------------------------------------------------------- /Grid/Objc/GridViewExample/Base.lproj/Main.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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 50 | 60 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 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 | -------------------------------------------------------------------------------- /Grid/Objc/GridViewExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | NSAppTransportSecurity 47 | 48 | NSAllowsArbitraryLoads 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /Grid/Objc/GridViewExample/MainCollectionViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // MainCollectionViewCell.h 3 | // GridViewExample 4 | // 5 | // Created by Adam Fish on 10/27/15. 6 | // Copyright © 2015 Adam Fish. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MainCollectionViewCell : UICollectionViewCell 12 | 13 | @property (strong, nonatomic) IBOutlet UIImageView *imageView; 14 | 15 | @property (strong, nonatomic) IBOutlet UILabel *titleLabel; 16 | 17 | @property (strong, nonatomic) IBOutlet UILabel *dateLabel; 18 | 19 | @property (strong, nonatomic) IBOutlet UILabel *excerptLabel; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Grid/Objc/GridViewExample/MainCollectionViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // MainCollectionViewCell.m 3 | // GridViewExample 4 | // 5 | // Created by Adam Fish on 10/27/15. 6 | // Copyright © 2015 Adam Fish. All rights reserved. 7 | // 8 | 9 | #import "MainCollectionViewCell.h" 10 | 11 | @implementation MainCollectionViewCell 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Grid/Objc/GridViewExample/MainGridController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MainGridController.h 3 | // GridViewExample 4 | // 5 | // Created by Adam Fish on 10/27/15. 6 | // Copyright © 2015 Adam Fish. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface MainGridController : ABFRealmGridController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Grid/Objc/GridViewExample/MainGridController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MainGridController.m 3 | // GridViewExample 4 | // 5 | // Created by Adam Fish on 10/27/15. 6 | // Copyright © 2015 Adam Fish. All rights reserved. 7 | // 8 | 9 | #import "MainGridController.h" 10 | #import "MainCollectionViewCell.h" 11 | 12 | #import 13 | #import 14 | #import 15 | #import 16 | #import 17 | 18 | @interface MainGridController () 19 | 20 | @end 21 | 22 | @implementation MainGridController 23 | 24 | static NSString * const reuseIdentifier = @"mainCell"; 25 | 26 | - (void)viewDidLoad { 27 | [super viewDidLoad]; 28 | 29 | self.entityName = @"NYTStory"; 30 | 31 | self.sortDescriptors = @[[RLMSortDescriptor sortDescriptorWithProperty:@"publishedDate" ascending:NO]]; 32 | } 33 | 34 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 35 | MainCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier 36 | forIndexPath:indexPath]; 37 | 38 | // Configure the cell 39 | NYTStory *story = [self objectAtIndexPath:indexPath]; 40 | 41 | cell.titleLabel.text = story.title; 42 | cell.dateLabel.text = [NYTStory stringFromDate:story.publishedDate]; 43 | cell.excerptLabel.text = story.abstract; 44 | 45 | // Use Haneke image caching 46 | [cell.imageView hnk_setImageFromURL:story.storyImage.url]; 47 | 48 | return cell; 49 | } 50 | 51 | - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath 52 | { 53 | [collectionView deselectItemAtIndexPath:indexPath animated:YES]; 54 | 55 | NYTStory *story = [self objectAtIndexPath:indexPath]; 56 | 57 | TOWebViewController *webController = [[TOWebViewController alloc] initWithURLString:story.urlString]; 58 | 59 | UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:webController]; 60 | 61 | [self.navigationController presentViewController:navController animated:YES completion:nil]; 62 | } 63 | 64 | - (CGSize)collectionView:(UICollectionView *)collectionView 65 | layout:(UICollectionViewLayout *)collectionViewLayout 66 | sizeForItemAtIndexPath:(NSIndexPath *)indexPath { 67 | 68 | CGFloat height = 250.0; 69 | 70 | if ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortrait) { 71 | CGFloat columns = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 3.0 : 2.0; 72 | 73 | CGFloat width = CGRectGetWidth(self.view.frame) / columns; 74 | 75 | return CGSizeMake(width, height); 76 | } 77 | else { 78 | CGFloat columns = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 4.0 : 3.0; 79 | 80 | CGFloat width = CGRectGetWidth(self.view.frame) / columns; 81 | 82 | return CGSizeMake(width, height); 83 | } 84 | } 85 | 86 | - (IBAction)didClickRefreshButton:(UIBarButtonItem *)sender 87 | { 88 | [NYTStory loadLatestStoriesIntoRealm:[RLMRealm defaultRealm] 89 | withAPIKey:@"INSERT_YOUR_API_KEY_HERE"]; 90 | } 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /Grid/Objc/GridViewExample/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // GridViewExample 4 | // 5 | // Created by Adam Fish on 10/27/15. 6 | // Copyright © 2015 Adam Fish. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Grid/Objc/GridViewExample/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // GridViewExample 4 | // 5 | // Created by Adam Fish on 10/27/15. 6 | // Copyright © 2015 Adam Fish. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Grid/Objc/GridViewExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GridViewExample 4 | // 5 | // Created by Adam Fish on 10/27/15. 6 | // Copyright © 2015 Adam Fish. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Grid/Objc/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '8.0' 3 | # Uncomment this line if you're using Swift 4 | # use_frameworks! 5 | 6 | target 'GridViewExample' do 7 | pod 'ABFRealmGridController' 8 | 9 | # Pre-built data model for New York Times Top Stories API 10 | pod 'RealmNYTStories' 11 | 12 | # Image loading/caching library 13 | pod 'Haneke' 14 | 15 | # Easy UIViewController to display website 16 | pod 'TOWebViewController' 17 | end 18 | 19 | -------------------------------------------------------------------------------- /Grid/Swift/GridViewExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A0D486C11BDEC7D9001FE79D /* MainGridController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0D486C01BDEC7D9001FE79D /* MainGridController.swift */; }; 11 | A0D486C71BDEE3C0001FE79D /* MainCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0D486C61BDEE3C0001FE79D /* MainCollectionViewCell.swift */; }; 12 | A0DFC4A61BDAAE230058D79B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0DFC4A51BDAAE230058D79B /* AppDelegate.swift */; }; 13 | A0DFC4AB1BDAAE230058D79B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A0DFC4A91BDAAE230058D79B /* Main.storyboard */; }; 14 | A0DFC4AD1BDAAE230058D79B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A0DFC4AC1BDAAE230058D79B /* Assets.xcassets */; }; 15 | A0DFC4B01BDAAE230058D79B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A0DFC4AE1BDAAE230058D79B /* LaunchScreen.storyboard */; }; 16 | FC34A690BD36860BB6F7DDF3 /* Pods_GridViewExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B37BA581EFD31A474FAF5BAE /* Pods_GridViewExample.framework */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 12ACDD4289A33AE2DCC5F82A /* Pods-GridViewExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GridViewExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GridViewExample/Pods-GridViewExample.debug.xcconfig"; sourceTree = ""; }; 21 | A0D486C01BDEC7D9001FE79D /* MainGridController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainGridController.swift; sourceTree = ""; }; 22 | A0D486C61BDEE3C0001FE79D /* MainCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainCollectionViewCell.swift; sourceTree = ""; }; 23 | A0DFC4A21BDAAE230058D79B /* GridViewExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GridViewExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | A0DFC4A51BDAAE230058D79B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 25 | A0DFC4AA1BDAAE230058D79B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 26 | A0DFC4AC1BDAAE230058D79B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 27 | A0DFC4AF1BDAAE230058D79B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 28 | A0DFC4B11BDAAE230058D79B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29 | B37BA581EFD31A474FAF5BAE /* Pods_GridViewExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GridViewExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | EB24972AB7BF90AA27D8867A /* Pods-GridViewExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GridViewExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-GridViewExample/Pods-GridViewExample.release.xcconfig"; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | A0DFC49F1BDAAE230058D79B /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | FC34A690BD36860BB6F7DDF3 /* Pods_GridViewExample.framework in Frameworks */, 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXFrameworksBuildPhase section */ 43 | 44 | /* Begin PBXGroup section */ 45 | 66E4C219517CED3769851244 /* Pods */ = { 46 | isa = PBXGroup; 47 | children = ( 48 | 12ACDD4289A33AE2DCC5F82A /* Pods-GridViewExample.debug.xcconfig */, 49 | EB24972AB7BF90AA27D8867A /* Pods-GridViewExample.release.xcconfig */, 50 | ); 51 | name = Pods; 52 | sourceTree = ""; 53 | }; 54 | 757A5EF6F5FA769EE7A49937 /* Frameworks */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | B37BA581EFD31A474FAF5BAE /* Pods_GridViewExample.framework */, 58 | ); 59 | name = Frameworks; 60 | sourceTree = ""; 61 | }; 62 | A0DFC4991BDAAE230058D79B = { 63 | isa = PBXGroup; 64 | children = ( 65 | A0DFC4A41BDAAE230058D79B /* GridViewExample */, 66 | A0DFC4A31BDAAE230058D79B /* Products */, 67 | 66E4C219517CED3769851244 /* Pods */, 68 | 757A5EF6F5FA769EE7A49937 /* Frameworks */, 69 | ); 70 | sourceTree = ""; 71 | }; 72 | A0DFC4A31BDAAE230058D79B /* Products */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | A0DFC4A21BDAAE230058D79B /* GridViewExample.app */, 76 | ); 77 | name = Products; 78 | sourceTree = ""; 79 | }; 80 | A0DFC4A41BDAAE230058D79B /* GridViewExample */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | A0DFC4A51BDAAE230058D79B /* AppDelegate.swift */, 84 | A0D486C01BDEC7D9001FE79D /* MainGridController.swift */, 85 | A0D486C61BDEE3C0001FE79D /* MainCollectionViewCell.swift */, 86 | A0DFC4A91BDAAE230058D79B /* Main.storyboard */, 87 | A0DFC4AC1BDAAE230058D79B /* Assets.xcassets */, 88 | A0DFC4AE1BDAAE230058D79B /* LaunchScreen.storyboard */, 89 | A0DFC4B11BDAAE230058D79B /* Info.plist */, 90 | ); 91 | path = GridViewExample; 92 | sourceTree = ""; 93 | }; 94 | /* End PBXGroup section */ 95 | 96 | /* Begin PBXNativeTarget section */ 97 | A0DFC4A11BDAAE230058D79B /* GridViewExample */ = { 98 | isa = PBXNativeTarget; 99 | buildConfigurationList = A0DFC4B41BDAAE230058D79B /* Build configuration list for PBXNativeTarget "GridViewExample" */; 100 | buildPhases = ( 101 | 2A6580F79A57D7F1D5749E44 /* Check Pods Manifest.lock */, 102 | A0DFC49E1BDAAE230058D79B /* Sources */, 103 | A0DFC49F1BDAAE230058D79B /* Frameworks */, 104 | A0DFC4A01BDAAE230058D79B /* Resources */, 105 | 1BB2DEEBD78F0508FFEF2391 /* Embed Pods Frameworks */, 106 | 3F654152F04C1267588E2B5A /* Copy Pods Resources */, 107 | ); 108 | buildRules = ( 109 | ); 110 | dependencies = ( 111 | ); 112 | name = GridViewExample; 113 | productName = GridViewExample; 114 | productReference = A0DFC4A21BDAAE230058D79B /* GridViewExample.app */; 115 | productType = "com.apple.product-type.application"; 116 | }; 117 | /* End PBXNativeTarget section */ 118 | 119 | /* Begin PBXProject section */ 120 | A0DFC49A1BDAAE230058D79B /* Project object */ = { 121 | isa = PBXProject; 122 | attributes = { 123 | LastSwiftUpdateCheck = 0710; 124 | LastUpgradeCheck = 0710; 125 | ORGANIZATIONNAME = "Adam Fish"; 126 | TargetAttributes = { 127 | A0DFC4A11BDAAE230058D79B = { 128 | CreatedOnToolsVersion = 7.1; 129 | }; 130 | }; 131 | }; 132 | buildConfigurationList = A0DFC49D1BDAAE230058D79B /* Build configuration list for PBXProject "GridViewExample" */; 133 | compatibilityVersion = "Xcode 3.2"; 134 | developmentRegion = English; 135 | hasScannedForEncodings = 0; 136 | knownRegions = ( 137 | en, 138 | Base, 139 | ); 140 | mainGroup = A0DFC4991BDAAE230058D79B; 141 | productRefGroup = A0DFC4A31BDAAE230058D79B /* Products */; 142 | projectDirPath = ""; 143 | projectRoot = ""; 144 | targets = ( 145 | A0DFC4A11BDAAE230058D79B /* GridViewExample */, 146 | ); 147 | }; 148 | /* End PBXProject section */ 149 | 150 | /* Begin PBXResourcesBuildPhase section */ 151 | A0DFC4A01BDAAE230058D79B /* Resources */ = { 152 | isa = PBXResourcesBuildPhase; 153 | buildActionMask = 2147483647; 154 | files = ( 155 | A0DFC4B01BDAAE230058D79B /* LaunchScreen.storyboard in Resources */, 156 | A0DFC4AD1BDAAE230058D79B /* Assets.xcassets in Resources */, 157 | A0DFC4AB1BDAAE230058D79B /* Main.storyboard in Resources */, 158 | ); 159 | runOnlyForDeploymentPostprocessing = 0; 160 | }; 161 | /* End PBXResourcesBuildPhase section */ 162 | 163 | /* Begin PBXShellScriptBuildPhase section */ 164 | 1BB2DEEBD78F0508FFEF2391 /* Embed Pods Frameworks */ = { 165 | isa = PBXShellScriptBuildPhase; 166 | buildActionMask = 2147483647; 167 | files = ( 168 | ); 169 | inputPaths = ( 170 | ); 171 | name = "Embed Pods Frameworks"; 172 | outputPaths = ( 173 | ); 174 | runOnlyForDeploymentPostprocessing = 0; 175 | shellPath = /bin/sh; 176 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GridViewExample/Pods-GridViewExample-frameworks.sh\"\n"; 177 | showEnvVarsInLog = 0; 178 | }; 179 | 2A6580F79A57D7F1D5749E44 /* Check Pods Manifest.lock */ = { 180 | isa = PBXShellScriptBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | ); 184 | inputPaths = ( 185 | ); 186 | name = "Check Pods Manifest.lock"; 187 | outputPaths = ( 188 | ); 189 | runOnlyForDeploymentPostprocessing = 0; 190 | shellPath = /bin/sh; 191 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 192 | showEnvVarsInLog = 0; 193 | }; 194 | 3F654152F04C1267588E2B5A /* Copy Pods Resources */ = { 195 | isa = PBXShellScriptBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | ); 199 | inputPaths = ( 200 | ); 201 | name = "Copy Pods Resources"; 202 | outputPaths = ( 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | shellPath = /bin/sh; 206 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GridViewExample/Pods-GridViewExample-resources.sh\"\n"; 207 | showEnvVarsInLog = 0; 208 | }; 209 | /* End PBXShellScriptBuildPhase section */ 210 | 211 | /* Begin PBXSourcesBuildPhase section */ 212 | A0DFC49E1BDAAE230058D79B /* Sources */ = { 213 | isa = PBXSourcesBuildPhase; 214 | buildActionMask = 2147483647; 215 | files = ( 216 | A0D486C11BDEC7D9001FE79D /* MainGridController.swift in Sources */, 217 | A0D486C71BDEE3C0001FE79D /* MainCollectionViewCell.swift in Sources */, 218 | A0DFC4A61BDAAE230058D79B /* AppDelegate.swift in Sources */, 219 | ); 220 | runOnlyForDeploymentPostprocessing = 0; 221 | }; 222 | /* End PBXSourcesBuildPhase section */ 223 | 224 | /* Begin PBXVariantGroup section */ 225 | A0DFC4A91BDAAE230058D79B /* Main.storyboard */ = { 226 | isa = PBXVariantGroup; 227 | children = ( 228 | A0DFC4AA1BDAAE230058D79B /* Base */, 229 | ); 230 | name = Main.storyboard; 231 | sourceTree = ""; 232 | }; 233 | A0DFC4AE1BDAAE230058D79B /* LaunchScreen.storyboard */ = { 234 | isa = PBXVariantGroup; 235 | children = ( 236 | A0DFC4AF1BDAAE230058D79B /* Base */, 237 | ); 238 | name = LaunchScreen.storyboard; 239 | sourceTree = ""; 240 | }; 241 | /* End PBXVariantGroup section */ 242 | 243 | /* Begin XCBuildConfiguration section */ 244 | A0DFC4B21BDAAE230058D79B /* Debug */ = { 245 | isa = XCBuildConfiguration; 246 | buildSettings = { 247 | ALWAYS_SEARCH_USER_PATHS = NO; 248 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 249 | CLANG_CXX_LIBRARY = "libc++"; 250 | CLANG_ENABLE_MODULES = YES; 251 | CLANG_ENABLE_OBJC_ARC = YES; 252 | CLANG_WARN_BOOL_CONVERSION = YES; 253 | CLANG_WARN_CONSTANT_CONVERSION = YES; 254 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 255 | CLANG_WARN_EMPTY_BODY = YES; 256 | CLANG_WARN_ENUM_CONVERSION = YES; 257 | CLANG_WARN_INT_CONVERSION = YES; 258 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 259 | CLANG_WARN_UNREACHABLE_CODE = YES; 260 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 261 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 262 | COPY_PHASE_STRIP = NO; 263 | DEBUG_INFORMATION_FORMAT = dwarf; 264 | ENABLE_STRICT_OBJC_MSGSEND = YES; 265 | ENABLE_TESTABILITY = YES; 266 | GCC_C_LANGUAGE_STANDARD = gnu99; 267 | GCC_DYNAMIC_NO_PIC = NO; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_OPTIMIZATION_LEVEL = 0; 270 | GCC_PREPROCESSOR_DEFINITIONS = ( 271 | "DEBUG=1", 272 | "$(inherited)", 273 | ); 274 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 275 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 276 | GCC_WARN_UNDECLARED_SELECTOR = YES; 277 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 278 | GCC_WARN_UNUSED_FUNCTION = YES; 279 | GCC_WARN_UNUSED_VARIABLE = YES; 280 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 281 | MTL_ENABLE_DEBUG_INFO = YES; 282 | ONLY_ACTIVE_ARCH = YES; 283 | SDKROOT = iphoneos; 284 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 285 | TARGETED_DEVICE_FAMILY = "1,2"; 286 | }; 287 | name = Debug; 288 | }; 289 | A0DFC4B31BDAAE230058D79B /* Release */ = { 290 | isa = XCBuildConfiguration; 291 | buildSettings = { 292 | ALWAYS_SEARCH_USER_PATHS = NO; 293 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 294 | CLANG_CXX_LIBRARY = "libc++"; 295 | CLANG_ENABLE_MODULES = YES; 296 | CLANG_ENABLE_OBJC_ARC = YES; 297 | CLANG_WARN_BOOL_CONVERSION = YES; 298 | CLANG_WARN_CONSTANT_CONVERSION = YES; 299 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 300 | CLANG_WARN_EMPTY_BODY = YES; 301 | CLANG_WARN_ENUM_CONVERSION = YES; 302 | CLANG_WARN_INT_CONVERSION = YES; 303 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 304 | CLANG_WARN_UNREACHABLE_CODE = YES; 305 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 306 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 307 | COPY_PHASE_STRIP = NO; 308 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 309 | ENABLE_NS_ASSERTIONS = NO; 310 | ENABLE_STRICT_OBJC_MSGSEND = YES; 311 | GCC_C_LANGUAGE_STANDARD = gnu99; 312 | GCC_NO_COMMON_BLOCKS = YES; 313 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 314 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 315 | GCC_WARN_UNDECLARED_SELECTOR = YES; 316 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 317 | GCC_WARN_UNUSED_FUNCTION = YES; 318 | GCC_WARN_UNUSED_VARIABLE = YES; 319 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 320 | MTL_ENABLE_DEBUG_INFO = NO; 321 | SDKROOT = iphoneos; 322 | TARGETED_DEVICE_FAMILY = "1,2"; 323 | VALIDATE_PRODUCT = YES; 324 | }; 325 | name = Release; 326 | }; 327 | A0DFC4B51BDAAE230058D79B /* Debug */ = { 328 | isa = XCBuildConfiguration; 329 | baseConfigurationReference = 12ACDD4289A33AE2DCC5F82A /* Pods-GridViewExample.debug.xcconfig */; 330 | buildSettings = { 331 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 332 | INFOPLIST_FILE = GridViewExample/Info.plist; 333 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 334 | PRODUCT_BUNDLE_IDENTIFIER = com.Realm.GridViewExample; 335 | PRODUCT_NAME = "$(TARGET_NAME)"; 336 | }; 337 | name = Debug; 338 | }; 339 | A0DFC4B61BDAAE230058D79B /* Release */ = { 340 | isa = XCBuildConfiguration; 341 | baseConfigurationReference = EB24972AB7BF90AA27D8867A /* Pods-GridViewExample.release.xcconfig */; 342 | buildSettings = { 343 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 344 | INFOPLIST_FILE = GridViewExample/Info.plist; 345 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 346 | PRODUCT_BUNDLE_IDENTIFIER = com.Realm.GridViewExample; 347 | PRODUCT_NAME = "$(TARGET_NAME)"; 348 | }; 349 | name = Release; 350 | }; 351 | /* End XCBuildConfiguration section */ 352 | 353 | /* Begin XCConfigurationList section */ 354 | A0DFC49D1BDAAE230058D79B /* Build configuration list for PBXProject "GridViewExample" */ = { 355 | isa = XCConfigurationList; 356 | buildConfigurations = ( 357 | A0DFC4B21BDAAE230058D79B /* Debug */, 358 | A0DFC4B31BDAAE230058D79B /* Release */, 359 | ); 360 | defaultConfigurationIsVisible = 0; 361 | defaultConfigurationName = Release; 362 | }; 363 | A0DFC4B41BDAAE230058D79B /* Build configuration list for PBXNativeTarget "GridViewExample" */ = { 364 | isa = XCConfigurationList; 365 | buildConfigurations = ( 366 | A0DFC4B51BDAAE230058D79B /* Debug */, 367 | A0DFC4B61BDAAE230058D79B /* Release */, 368 | ); 369 | defaultConfigurationIsVisible = 0; 370 | defaultConfigurationName = Release; 371 | }; 372 | /* End XCConfigurationList section */ 373 | }; 374 | rootObject = A0DFC49A1BDAAE230058D79B /* Project object */; 375 | } 376 | -------------------------------------------------------------------------------- /Grid/Swift/GridViewExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // GridViewExample 4 | // 5 | // Created by Adam Fish on 10/23/15. 6 | // Copyright © 2015 Adam Fish. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Grid/Swift/GridViewExample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Grid/Swift/GridViewExample/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 | 27 | 28 | -------------------------------------------------------------------------------- /Grid/Swift/GridViewExample/Base.lproj/Main.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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 51 | 58 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 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 | -------------------------------------------------------------------------------- /Grid/Swift/GridViewExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | NSAppTransportSecurity 47 | 48 | NSAllowsArbitraryLoads 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /Grid/Swift/GridViewExample/MainCollectionViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MainCollectionViewCell.swift 3 | // GridViewExample 4 | // 5 | // Created by Adam Fish on 10/26/15. 6 | // Copyright © 2015 Adam Fish. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class MainCollectionViewCell: UICollectionViewCell { 12 | @IBOutlet var imageView: UIImageView! 13 | 14 | @IBOutlet var titleLabel: UILabel! 15 | 16 | @IBOutlet var dateLabel: UILabel! 17 | 18 | @IBOutlet var excerptLabel: UILabel! 19 | } 20 | -------------------------------------------------------------------------------- /Grid/Swift/GridViewExample/MainGridController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MainGridController.swift 3 | // GridViewExample 4 | // 5 | // Created by Adam Fish on 10/26/15. 6 | // Copyright © 2015 Adam Fish. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import RealmSwiftNYTStories 11 | import RealmGridController 12 | import RealmSwift 13 | import Haneke 14 | import TOWebViewController 15 | 16 | private let reuseIdentifier = "mainCell" 17 | 18 | class MainGridController: RealmGridController { 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | 23 | // Set the Realm object class name that the grid controller will bind to 24 | self.entityName = "NYTStory" 25 | 26 | // Sort the article in reverse chronological order 27 | self.sortDescriptors = [SortDescriptor(property: "publishedDate", ascending: false)] 28 | } 29 | 30 | override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { 31 | let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! MainCollectionViewCell 32 | 33 | // Configure the cell 34 | let aStory = self.objectAtIndexPath(NYTStory.self, indexPath: indexPath) 35 | 36 | cell.titleLabel.text = aStory?.title 37 | cell.excerptLabel.text = aStory?.abstract 38 | 39 | if let date = aStory?.publishedDate { 40 | cell.dateLabel.text = NYTStory.stringFromDate(date) 41 | } 42 | 43 | // Lazy load image using Haneke library 44 | if let imageURL = aStory?.storyImage?.url { 45 | cell.imageView.hnk_setImageFromURL(imageURL) 46 | } 47 | 48 | return cell 49 | } 50 | 51 | override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) { 52 | collectionView.deselectItemAtIndexPath(indexPath, animated: true) 53 | 54 | let story = self.objectAtIndexPath(NYTStory.self, indexPath: indexPath) 55 | 56 | if let urlString = story?.urlString { 57 | let webController = TOWebViewController(URLString: urlString) 58 | 59 | let navController = UINavigationController(rootViewController: webController) 60 | 61 | self.navigationController?.presentViewController(navController, animated: true, completion: nil) 62 | } 63 | } 64 | 65 | func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize { 66 | let height: CGFloat = 250.0 67 | 68 | if UIApplication.sharedApplication().statusBarOrientation == UIInterfaceOrientation.Portrait { 69 | let columns: CGFloat = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.Pad ? 3.0 : 2.0 70 | 71 | let width = CGRectGetWidth(self.view.frame) / columns 72 | 73 | return CGSizeMake(width, height) 74 | } 75 | else { 76 | let columns: CGFloat = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.Pad ? 4.0 : 3.0 77 | 78 | let width = CGRectGetWidth(self.view.frame) / columns 79 | 80 | return CGSizeMake(width, height) 81 | } 82 | } 83 | 84 | @IBAction func didClickRefreshButton(sender: UIBarButtonItem) { 85 | NYTStory.loadLatestStories(intoRealm: try! Realm(), withAPIKey: "INSERT_YOUR_API_KEY_HERE"); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Grid/Swift/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | target 'GridViewExample' do 4 | 5 | pod 'RealmGridController' 6 | 7 | # Pre-built data model for New York Times Top Stories API 8 | pod 'RealmSwiftNYTStories' 9 | 10 | # Image loading/caching library 11 | pod 'HanekeSwift' 12 | 13 | # Easy UIViewController to display website 14 | pod 'TOWebViewController' 15 | 16 | 17 | end 18 | 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Adam Fish 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 | 23 | -------------------------------------------------------------------------------- /Map/Swift/MapViewExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 049469B3465F0679CDA20508 /* Pods_MapViewExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B8C56F53E5C05C6512B4D61A /* Pods_MapViewExample.framework */; }; 11 | A0D487011BE16E70001FE79D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0D487001BE16E70001FE79D /* AppDelegate.swift */; }; 12 | A0D487031BE16E70001FE79D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0D487021BE16E70001FE79D /* ViewController.swift */; }; 13 | A0D487061BE16E70001FE79D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A0D487041BE16E70001FE79D /* Main.storyboard */; }; 14 | A0D487081BE16E70001FE79D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A0D487071BE16E70001FE79D /* Assets.xcassets */; }; 15 | A0D4870B1BE16E70001FE79D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A0D487091BE16E70001FE79D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 3F3CCAE8BEC7D6FE1FADF656 /* Pods-MapViewExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MapViewExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-MapViewExample/Pods-MapViewExample.release.xcconfig"; sourceTree = ""; }; 20 | 4D09DD966993467DD5B24052 /* Pods-MapViewExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MapViewExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MapViewExample/Pods-MapViewExample.debug.xcconfig"; sourceTree = ""; }; 21 | A0D486FD1BE16E70001FE79D /* MapViewExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MapViewExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | A0D487001BE16E70001FE79D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 23 | A0D487021BE16E70001FE79D /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 24 | A0D487051BE16E70001FE79D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 25 | A0D487071BE16E70001FE79D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | A0D4870A1BE16E70001FE79D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | A0D4870C1BE16E70001FE79D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | B8C56F53E5C05C6512B4D61A /* Pods_MapViewExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MapViewExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | A0D486FA1BE16E70001FE79D /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | 049469B3465F0679CDA20508 /* Pods_MapViewExample.framework in Frameworks */, 37 | ); 38 | runOnlyForDeploymentPostprocessing = 0; 39 | }; 40 | /* End PBXFrameworksBuildPhase section */ 41 | 42 | /* Begin PBXGroup section */ 43 | 9CBDA245F3A463281F8AE3BB /* Pods */ = { 44 | isa = PBXGroup; 45 | children = ( 46 | 4D09DD966993467DD5B24052 /* Pods-MapViewExample.debug.xcconfig */, 47 | 3F3CCAE8BEC7D6FE1FADF656 /* Pods-MapViewExample.release.xcconfig */, 48 | ); 49 | name = Pods; 50 | sourceTree = ""; 51 | }; 52 | A0D486F41BE16E70001FE79D = { 53 | isa = PBXGroup; 54 | children = ( 55 | A0D486FF1BE16E70001FE79D /* MapViewExample */, 56 | A0D486FE1BE16E70001FE79D /* Products */, 57 | 9CBDA245F3A463281F8AE3BB /* Pods */, 58 | B079E21C43B5DA822FE2E4C8 /* Frameworks */, 59 | ); 60 | sourceTree = ""; 61 | }; 62 | A0D486FE1BE16E70001FE79D /* Products */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | A0D486FD1BE16E70001FE79D /* MapViewExample.app */, 66 | ); 67 | name = Products; 68 | sourceTree = ""; 69 | }; 70 | A0D486FF1BE16E70001FE79D /* MapViewExample */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | A0D487001BE16E70001FE79D /* AppDelegate.swift */, 74 | A0D487021BE16E70001FE79D /* ViewController.swift */, 75 | A0D487041BE16E70001FE79D /* Main.storyboard */, 76 | A0D487071BE16E70001FE79D /* Assets.xcassets */, 77 | A0D487091BE16E70001FE79D /* LaunchScreen.storyboard */, 78 | A0D4870C1BE16E70001FE79D /* Info.plist */, 79 | ); 80 | path = MapViewExample; 81 | sourceTree = ""; 82 | }; 83 | B079E21C43B5DA822FE2E4C8 /* Frameworks */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | B8C56F53E5C05C6512B4D61A /* Pods_MapViewExample.framework */, 87 | ); 88 | name = Frameworks; 89 | sourceTree = ""; 90 | }; 91 | /* End PBXGroup section */ 92 | 93 | /* Begin PBXNativeTarget section */ 94 | A0D486FC1BE16E70001FE79D /* MapViewExample */ = { 95 | isa = PBXNativeTarget; 96 | buildConfigurationList = A0D4870F1BE16E70001FE79D /* Build configuration list for PBXNativeTarget "MapViewExample" */; 97 | buildPhases = ( 98 | 7E778F3CE0578BF501167640 /* Check Pods Manifest.lock */, 99 | A0D486F91BE16E70001FE79D /* Sources */, 100 | A0D486FA1BE16E70001FE79D /* Frameworks */, 101 | A0D486FB1BE16E70001FE79D /* Resources */, 102 | 7F0EB52502A8499331370971 /* Embed Pods Frameworks */, 103 | E30D67588FC3C75EDD93D705 /* Copy Pods Resources */, 104 | ); 105 | buildRules = ( 106 | ); 107 | dependencies = ( 108 | ); 109 | name = MapViewExample; 110 | productName = MapViewExample; 111 | productReference = A0D486FD1BE16E70001FE79D /* MapViewExample.app */; 112 | productType = "com.apple.product-type.application"; 113 | }; 114 | /* End PBXNativeTarget section */ 115 | 116 | /* Begin PBXProject section */ 117 | A0D486F51BE16E70001FE79D /* Project object */ = { 118 | isa = PBXProject; 119 | attributes = { 120 | LastSwiftUpdateCheck = 0710; 121 | LastUpgradeCheck = 0710; 122 | ORGANIZATIONNAME = "Adam Fish"; 123 | TargetAttributes = { 124 | A0D486FC1BE16E70001FE79D = { 125 | CreatedOnToolsVersion = 7.1; 126 | }; 127 | }; 128 | }; 129 | buildConfigurationList = A0D486F81BE16E70001FE79D /* Build configuration list for PBXProject "MapViewExample" */; 130 | compatibilityVersion = "Xcode 3.2"; 131 | developmentRegion = English; 132 | hasScannedForEncodings = 0; 133 | knownRegions = ( 134 | en, 135 | Base, 136 | ); 137 | mainGroup = A0D486F41BE16E70001FE79D; 138 | productRefGroup = A0D486FE1BE16E70001FE79D /* Products */; 139 | projectDirPath = ""; 140 | projectRoot = ""; 141 | targets = ( 142 | A0D486FC1BE16E70001FE79D /* MapViewExample */, 143 | ); 144 | }; 145 | /* End PBXProject section */ 146 | 147 | /* Begin PBXResourcesBuildPhase section */ 148 | A0D486FB1BE16E70001FE79D /* Resources */ = { 149 | isa = PBXResourcesBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | A0D4870B1BE16E70001FE79D /* LaunchScreen.storyboard in Resources */, 153 | A0D487081BE16E70001FE79D /* Assets.xcassets in Resources */, 154 | A0D487061BE16E70001FE79D /* Main.storyboard in Resources */, 155 | ); 156 | runOnlyForDeploymentPostprocessing = 0; 157 | }; 158 | /* End PBXResourcesBuildPhase section */ 159 | 160 | /* Begin PBXShellScriptBuildPhase section */ 161 | 7E778F3CE0578BF501167640 /* Check Pods Manifest.lock */ = { 162 | isa = PBXShellScriptBuildPhase; 163 | buildActionMask = 2147483647; 164 | files = ( 165 | ); 166 | inputPaths = ( 167 | ); 168 | name = "Check Pods Manifest.lock"; 169 | outputPaths = ( 170 | ); 171 | runOnlyForDeploymentPostprocessing = 0; 172 | shellPath = /bin/sh; 173 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 174 | showEnvVarsInLog = 0; 175 | }; 176 | 7F0EB52502A8499331370971 /* Embed Pods Frameworks */ = { 177 | isa = PBXShellScriptBuildPhase; 178 | buildActionMask = 2147483647; 179 | files = ( 180 | ); 181 | inputPaths = ( 182 | ); 183 | name = "Embed Pods Frameworks"; 184 | outputPaths = ( 185 | ); 186 | runOnlyForDeploymentPostprocessing = 0; 187 | shellPath = /bin/sh; 188 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MapViewExample/Pods-MapViewExample-frameworks.sh\"\n"; 189 | showEnvVarsInLog = 0; 190 | }; 191 | E30D67588FC3C75EDD93D705 /* Copy Pods Resources */ = { 192 | isa = PBXShellScriptBuildPhase; 193 | buildActionMask = 2147483647; 194 | files = ( 195 | ); 196 | inputPaths = ( 197 | ); 198 | name = "Copy Pods Resources"; 199 | outputPaths = ( 200 | ); 201 | runOnlyForDeploymentPostprocessing = 0; 202 | shellPath = /bin/sh; 203 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MapViewExample/Pods-MapViewExample-resources.sh\"\n"; 204 | showEnvVarsInLog = 0; 205 | }; 206 | /* End PBXShellScriptBuildPhase section */ 207 | 208 | /* Begin PBXSourcesBuildPhase section */ 209 | A0D486F91BE16E70001FE79D /* Sources */ = { 210 | isa = PBXSourcesBuildPhase; 211 | buildActionMask = 2147483647; 212 | files = ( 213 | A0D487031BE16E70001FE79D /* ViewController.swift in Sources */, 214 | A0D487011BE16E70001FE79D /* AppDelegate.swift in Sources */, 215 | ); 216 | runOnlyForDeploymentPostprocessing = 0; 217 | }; 218 | /* End PBXSourcesBuildPhase section */ 219 | 220 | /* Begin PBXVariantGroup section */ 221 | A0D487041BE16E70001FE79D /* Main.storyboard */ = { 222 | isa = PBXVariantGroup; 223 | children = ( 224 | A0D487051BE16E70001FE79D /* Base */, 225 | ); 226 | name = Main.storyboard; 227 | sourceTree = ""; 228 | }; 229 | A0D487091BE16E70001FE79D /* LaunchScreen.storyboard */ = { 230 | isa = PBXVariantGroup; 231 | children = ( 232 | A0D4870A1BE16E70001FE79D /* Base */, 233 | ); 234 | name = LaunchScreen.storyboard; 235 | sourceTree = ""; 236 | }; 237 | /* End PBXVariantGroup section */ 238 | 239 | /* Begin XCBuildConfiguration section */ 240 | A0D4870D1BE16E70001FE79D /* Debug */ = { 241 | isa = XCBuildConfiguration; 242 | buildSettings = { 243 | ALWAYS_SEARCH_USER_PATHS = NO; 244 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 245 | CLANG_CXX_LIBRARY = "libc++"; 246 | CLANG_ENABLE_MODULES = YES; 247 | CLANG_ENABLE_OBJC_ARC = YES; 248 | CLANG_WARN_BOOL_CONVERSION = YES; 249 | CLANG_WARN_CONSTANT_CONVERSION = YES; 250 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 251 | CLANG_WARN_EMPTY_BODY = YES; 252 | CLANG_WARN_ENUM_CONVERSION = YES; 253 | CLANG_WARN_INT_CONVERSION = YES; 254 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 255 | CLANG_WARN_UNREACHABLE_CODE = YES; 256 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 257 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 258 | COPY_PHASE_STRIP = NO; 259 | DEBUG_INFORMATION_FORMAT = dwarf; 260 | ENABLE_STRICT_OBJC_MSGSEND = YES; 261 | ENABLE_TESTABILITY = YES; 262 | GCC_C_LANGUAGE_STANDARD = gnu99; 263 | GCC_DYNAMIC_NO_PIC = NO; 264 | GCC_NO_COMMON_BLOCKS = YES; 265 | GCC_OPTIMIZATION_LEVEL = 0; 266 | GCC_PREPROCESSOR_DEFINITIONS = ( 267 | "DEBUG=1", 268 | "$(inherited)", 269 | ); 270 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 271 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 272 | GCC_WARN_UNDECLARED_SELECTOR = YES; 273 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 274 | GCC_WARN_UNUSED_FUNCTION = YES; 275 | GCC_WARN_UNUSED_VARIABLE = YES; 276 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 277 | MTL_ENABLE_DEBUG_INFO = YES; 278 | ONLY_ACTIVE_ARCH = YES; 279 | SDKROOT = iphoneos; 280 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 281 | TARGETED_DEVICE_FAMILY = "1,2"; 282 | }; 283 | name = Debug; 284 | }; 285 | A0D4870E1BE16E70001FE79D /* Release */ = { 286 | isa = XCBuildConfiguration; 287 | buildSettings = { 288 | ALWAYS_SEARCH_USER_PATHS = NO; 289 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 290 | CLANG_CXX_LIBRARY = "libc++"; 291 | CLANG_ENABLE_MODULES = YES; 292 | CLANG_ENABLE_OBJC_ARC = YES; 293 | CLANG_WARN_BOOL_CONVERSION = YES; 294 | CLANG_WARN_CONSTANT_CONVERSION = YES; 295 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 296 | CLANG_WARN_EMPTY_BODY = YES; 297 | CLANG_WARN_ENUM_CONVERSION = YES; 298 | CLANG_WARN_INT_CONVERSION = YES; 299 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 300 | CLANG_WARN_UNREACHABLE_CODE = YES; 301 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 302 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 303 | COPY_PHASE_STRIP = NO; 304 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 305 | ENABLE_NS_ASSERTIONS = NO; 306 | ENABLE_STRICT_OBJC_MSGSEND = YES; 307 | GCC_C_LANGUAGE_STANDARD = gnu99; 308 | GCC_NO_COMMON_BLOCKS = YES; 309 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 310 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 311 | GCC_WARN_UNDECLARED_SELECTOR = YES; 312 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 313 | GCC_WARN_UNUSED_FUNCTION = YES; 314 | GCC_WARN_UNUSED_VARIABLE = YES; 315 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 316 | MTL_ENABLE_DEBUG_INFO = NO; 317 | SDKROOT = iphoneos; 318 | TARGETED_DEVICE_FAMILY = "1,2"; 319 | VALIDATE_PRODUCT = YES; 320 | }; 321 | name = Release; 322 | }; 323 | A0D487101BE16E70001FE79D /* Debug */ = { 324 | isa = XCBuildConfiguration; 325 | baseConfigurationReference = 4D09DD966993467DD5B24052 /* Pods-MapViewExample.debug.xcconfig */; 326 | buildSettings = { 327 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 328 | INFOPLIST_FILE = MapViewExample/Info.plist; 329 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 330 | PRODUCT_BUNDLE_IDENTIFIER = com.Realm.MapViewExample; 331 | PRODUCT_NAME = "$(TARGET_NAME)"; 332 | }; 333 | name = Debug; 334 | }; 335 | A0D487111BE16E70001FE79D /* Release */ = { 336 | isa = XCBuildConfiguration; 337 | baseConfigurationReference = 3F3CCAE8BEC7D6FE1FADF656 /* Pods-MapViewExample.release.xcconfig */; 338 | buildSettings = { 339 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 340 | INFOPLIST_FILE = MapViewExample/Info.plist; 341 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 342 | PRODUCT_BUNDLE_IDENTIFIER = com.Realm.MapViewExample; 343 | PRODUCT_NAME = "$(TARGET_NAME)"; 344 | }; 345 | name = Release; 346 | }; 347 | /* End XCBuildConfiguration section */ 348 | 349 | /* Begin XCConfigurationList section */ 350 | A0D486F81BE16E70001FE79D /* Build configuration list for PBXProject "MapViewExample" */ = { 351 | isa = XCConfigurationList; 352 | buildConfigurations = ( 353 | A0D4870D1BE16E70001FE79D /* Debug */, 354 | A0D4870E1BE16E70001FE79D /* Release */, 355 | ); 356 | defaultConfigurationIsVisible = 0; 357 | defaultConfigurationName = Release; 358 | }; 359 | A0D4870F1BE16E70001FE79D /* Build configuration list for PBXNativeTarget "MapViewExample" */ = { 360 | isa = XCConfigurationList; 361 | buildConfigurations = ( 362 | A0D487101BE16E70001FE79D /* Debug */, 363 | A0D487111BE16E70001FE79D /* Release */, 364 | ); 365 | defaultConfigurationIsVisible = 0; 366 | defaultConfigurationName = Release; 367 | }; 368 | /* End XCConfigurationList section */ 369 | }; 370 | rootObject = A0D486F51BE16E70001FE79D /* Project object */; 371 | } 372 | -------------------------------------------------------------------------------- /Map/Swift/MapViewExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // MapViewExample 4 | // 5 | // Created by Adam Fish on 10/28/15. 6 | // Copyright © 2015 Adam Fish. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Map/Swift/MapViewExample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Map/Swift/MapViewExample/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 | 27 | 28 | -------------------------------------------------------------------------------- /Map/Swift/MapViewExample/Base.lproj/Main.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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Map/Swift/MapViewExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Map/Swift/MapViewExample/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // MapViewExample 4 | // 5 | // Created by Adam Fish on 10/28/15. 6 | // Copyright © 2015 Adam Fish. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import RealmSwift 11 | import RealmSwiftSFRestaurantData 12 | import RealmMapView 13 | 14 | class ViewController: UIViewController { 15 | 16 | @IBOutlet var mapView: RealmMapView! 17 | 18 | override func viewDidLoad() { 19 | super.viewDidLoad() 20 | 21 | var config = Realm.Configuration.defaultConfiguration 22 | config.path = ABFRestaurantScoresPath() 23 | self.mapView.realmConfiguration = config 24 | 25 | self.mapView.fetchedResultsController.clusterTitleFormatString = "$OBJECTSCOUNT restaurants in this area" 26 | 27 | self.mapView.delegate = self 28 | } 29 | } 30 | 31 | extension ViewController: MKMapViewDelegate { 32 | func mapView(mapView: MKMapView, didSelectAnnotationView view: MKAnnotationView) { 33 | if let safeObjects = ABFClusterAnnotationView.safeObjectsForClusterAnnotationView(view) { 34 | 35 | if let firstObjectName = safeObjects.first?.toObject(ABFRestaurantObject).name { 36 | print("First Object: \(firstObjectName)") 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Map/Swift/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | target 'MapViewExample' do 4 | pod 'RealmMapView' 5 | 6 | # Map data set 7 | pod 'RealmSwiftSFRestaurantData' 8 | end 9 | 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RealmTutorials 2 | A collection of various Realm tutorials. Get instructions at realm.io/addons/ 3 | --------------------------------------------------------------------------------