├── .gitignore ├── .swift-version ├── Example-iOS ├── Example-iOS.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata └── Example-iOS │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── CellSalmon.swift │ ├── CellSalmon.xib │ ├── CellSky.swift │ ├── CellSky.xib │ ├── Info.plist │ └── ViewController.swift ├── Example-tvOS ├── Example-tvOS.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata └── Example-tvOS │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── App Icon & Top Shelf Image.brandassets │ │ ├── App Icon - Large.imagestack │ │ │ ├── Back.imagestacklayer │ │ │ │ ├── Content.imageset │ │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ │ ├── Contents.json │ │ │ ├── Front.imagestacklayer │ │ │ │ ├── Content.imageset │ │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ │ └── Middle.imagestacklayer │ │ │ │ ├── Content.imageset │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ ├── App Icon - Small.imagestack │ │ │ ├── Back.imagestacklayer │ │ │ │ ├── Content.imageset │ │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ │ ├── Contents.json │ │ │ ├── Front.imagestacklayer │ │ │ │ ├── Content.imageset │ │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ │ └── Middle.imagestacklayer │ │ │ │ ├── Content.imageset │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── Top Shelf Image Wide.imageset │ │ │ └── Contents.json │ │ └── Top Shelf Image.imageset │ │ │ └── Contents.json │ ├── Contents.json │ ├── LaunchImage.launchimage │ │ └── Contents.json │ ├── chart.imageset │ │ ├── Contents.json │ │ └── html5_live_chart.png │ ├── elves.imageset │ │ ├── Contents.json │ │ └── druid.png │ ├── map.imageset │ │ ├── Contents.json │ │ └── Screen Shot 2017-04-28 at 18.00.54.png │ ├── merfolk.imageset │ │ ├── Contents.json │ │ └── merfolk.png │ ├── troll.imageset │ │ ├── Contents.json │ │ └── troll.png │ └── undead.imageset │ │ ├── Contents.json │ │ └── ghost.png │ ├── Base.lproj │ └── Main.storyboard │ ├── CellCharacter.swift │ ├── CellCharacter.xib │ ├── CellChart.swift │ ├── CellChart.xib │ ├── CellLogs.swift │ ├── CellLogs.xib │ ├── CellMap.swift │ ├── CellMap.xib │ ├── Info.plist │ ├── MainTvController.swift │ └── ProtocolCellRealTime.swift ├── GridView.podspec ├── GridView.xcworkspace └── contents.xcworkspacedata ├── GridView ├── GridView.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata └── GridView │ ├── GridConfiguration.swift │ ├── GridController.swift │ ├── GridLayout.swift │ ├── GridView.h │ ├── Info.plist │ └── Slot.swift ├── LICENSE ├── Podfile ├── Podfile.lock └── README.md /.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 | # CocoaPods 26 | Pods/ 27 | 28 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 3.1 2 | -------------------------------------------------------------------------------- /Example-iOS/Example-iOS.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6F91FD18FBFF35F23AE02069 /* Pods_Example_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 421A4B7D030A35CAB6FAE151 /* Pods_Example_iOS.framework */; }; 11 | 892FDEB51EB2153D00B1A333 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892FDEB41EB2153D00B1A333 /* AppDelegate.swift */; }; 12 | 892FDEB71EB2153D00B1A333 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892FDEB61EB2153D00B1A333 /* ViewController.swift */; }; 13 | 892FDEBA1EB2153D00B1A333 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 892FDEB81EB2153D00B1A333 /* Main.storyboard */; }; 14 | 892FDEBC1EB2153D00B1A333 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 892FDEBB1EB2153D00B1A333 /* Assets.xcassets */; }; 15 | 892FDEBF1EB2153D00B1A333 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 892FDEBD1EB2153D00B1A333 /* LaunchScreen.storyboard */; }; 16 | 89D4A76E1EB6BAA90006E05D /* CellSalmon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89D4A76D1EB6BAA90006E05D /* CellSalmon.swift */; }; 17 | 89D4A7721EB6BB5B0006E05D /* CellSky.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89D4A7711EB6BB5B0006E05D /* CellSky.swift */; }; 18 | 89D4A7741EB6BBE60006E05D /* CellSalmon.xib in Resources */ = {isa = PBXBuildFile; fileRef = 89D4A7731EB6BBE60006E05D /* CellSalmon.xib */; }; 19 | 89D4A7761EB6BC000006E05D /* CellSky.xib in Resources */ = {isa = PBXBuildFile; fileRef = 89D4A7751EB6BC000006E05D /* CellSky.xib */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 421A4B7D030A35CAB6FAE151 /* Pods_Example_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 892FDEB11EB2153D00B1A333 /* Example-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Example-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 25 | 892FDEB41EB2153D00B1A333 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 26 | 892FDEB61EB2153D00B1A333 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 27 | 892FDEB91EB2153D00B1A333 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 28 | 892FDEBB1EB2153D00B1A333 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 29 | 892FDEBE1EB2153D00B1A333 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 30 | 892FDEC01EB2153D00B1A333 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | 89D4A76D1EB6BAA90006E05D /* CellSalmon.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CellSalmon.swift; sourceTree = ""; }; 32 | 89D4A7711EB6BB5B0006E05D /* CellSky.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CellSky.swift; sourceTree = ""; }; 33 | 89D4A7731EB6BBE60006E05D /* CellSalmon.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CellSalmon.xib; sourceTree = ""; }; 34 | 89D4A7751EB6BC000006E05D /* CellSky.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CellSky.xib; sourceTree = ""; }; 35 | 9E1E11BF60A682EFA54521CF /* Pods-Example-iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-iOS.release.xcconfig"; path = "../Pods/Target Support Files/Pods-Example-iOS/Pods-Example-iOS.release.xcconfig"; sourceTree = ""; }; 36 | CA760D93AB523E1177AFF660 /* Pods-Example-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-iOS.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-Example-iOS/Pods-Example-iOS.debug.xcconfig"; sourceTree = ""; }; 37 | /* End PBXFileReference section */ 38 | 39 | /* Begin PBXFrameworksBuildPhase section */ 40 | 892FDEAE1EB2153D00B1A333 /* Frameworks */ = { 41 | isa = PBXFrameworksBuildPhase; 42 | buildActionMask = 2147483647; 43 | files = ( 44 | 6F91FD18FBFF35F23AE02069 /* Pods_Example_iOS.framework in Frameworks */, 45 | ); 46 | runOnlyForDeploymentPostprocessing = 0; 47 | }; 48 | /* End PBXFrameworksBuildPhase section */ 49 | 50 | /* Begin PBXGroup section */ 51 | 119D93D9FAE1663C0AB9FC02 /* Pods */ = { 52 | isa = PBXGroup; 53 | children = ( 54 | CA760D93AB523E1177AFF660 /* Pods-Example-iOS.debug.xcconfig */, 55 | 9E1E11BF60A682EFA54521CF /* Pods-Example-iOS.release.xcconfig */, 56 | ); 57 | name = Pods; 58 | sourceTree = ""; 59 | }; 60 | 892FDEA81EB2153D00B1A333 = { 61 | isa = PBXGroup; 62 | children = ( 63 | 892FDEB31EB2153D00B1A333 /* Example-iOS */, 64 | 892FDEB21EB2153D00B1A333 /* Products */, 65 | 119D93D9FAE1663C0AB9FC02 /* Pods */, 66 | AA5E8341B28D64846E47EB12 /* Frameworks */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 892FDEB21EB2153D00B1A333 /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 892FDEB11EB2153D00B1A333 /* Example-iOS.app */, 74 | ); 75 | name = Products; 76 | sourceTree = ""; 77 | }; 78 | 892FDEB31EB2153D00B1A333 /* Example-iOS */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 892FDEB41EB2153D00B1A333 /* AppDelegate.swift */, 82 | 892FDEB61EB2153D00B1A333 /* ViewController.swift */, 83 | 89D4A7731EB6BBE60006E05D /* CellSalmon.xib */, 84 | 89D4A76D1EB6BAA90006E05D /* CellSalmon.swift */, 85 | 89D4A7751EB6BC000006E05D /* CellSky.xib */, 86 | 89D4A7711EB6BB5B0006E05D /* CellSky.swift */, 87 | 892FDEB81EB2153D00B1A333 /* Main.storyboard */, 88 | 892FDEBB1EB2153D00B1A333 /* Assets.xcassets */, 89 | 892FDEBD1EB2153D00B1A333 /* LaunchScreen.storyboard */, 90 | 892FDEC01EB2153D00B1A333 /* Info.plist */, 91 | ); 92 | path = "Example-iOS"; 93 | sourceTree = ""; 94 | }; 95 | AA5E8341B28D64846E47EB12 /* Frameworks */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 421A4B7D030A35CAB6FAE151 /* Pods_Example_iOS.framework */, 99 | ); 100 | name = Frameworks; 101 | sourceTree = ""; 102 | }; 103 | /* End PBXGroup section */ 104 | 105 | /* Begin PBXNativeTarget section */ 106 | 892FDEB01EB2153D00B1A333 /* Example-iOS */ = { 107 | isa = PBXNativeTarget; 108 | buildConfigurationList = 892FDEC31EB2153D00B1A333 /* Build configuration list for PBXNativeTarget "Example-iOS" */; 109 | buildPhases = ( 110 | 26A667C078D2F5E8EF6F8056 /* [CP] Check Pods Manifest.lock */, 111 | 892FDEAD1EB2153D00B1A333 /* Sources */, 112 | 892FDEAE1EB2153D00B1A333 /* Frameworks */, 113 | 892FDEAF1EB2153D00B1A333 /* Resources */, 114 | 2B6997793C52BCB6886BD793 /* [CP] Embed Pods Frameworks */, 115 | 75DBE7C2C804007FA45E70A4 /* [CP] Copy Pods Resources */, 116 | ); 117 | buildRules = ( 118 | ); 119 | dependencies = ( 120 | ); 121 | name = "Example-iOS"; 122 | productName = "Example-iOS"; 123 | productReference = 892FDEB11EB2153D00B1A333 /* Example-iOS.app */; 124 | productType = "com.apple.product-type.application"; 125 | }; 126 | /* End PBXNativeTarget section */ 127 | 128 | /* Begin PBXProject section */ 129 | 892FDEA91EB2153D00B1A333 /* Project object */ = { 130 | isa = PBXProject; 131 | attributes = { 132 | LastSwiftUpdateCheck = 0830; 133 | LastUpgradeCheck = 0830; 134 | ORGANIZATIONNAME = "Bruno Macabeus Aquino"; 135 | TargetAttributes = { 136 | 892FDEB01EB2153D00B1A333 = { 137 | CreatedOnToolsVersion = 8.3; 138 | DevelopmentTeam = 56KUK57QCP; 139 | ProvisioningStyle = Automatic; 140 | }; 141 | }; 142 | }; 143 | buildConfigurationList = 892FDEAC1EB2153D00B1A333 /* Build configuration list for PBXProject "Example-iOS" */; 144 | compatibilityVersion = "Xcode 3.2"; 145 | developmentRegion = English; 146 | hasScannedForEncodings = 0; 147 | knownRegions = ( 148 | en, 149 | Base, 150 | ); 151 | mainGroup = 892FDEA81EB2153D00B1A333; 152 | productRefGroup = 892FDEB21EB2153D00B1A333 /* Products */; 153 | projectDirPath = ""; 154 | projectRoot = ""; 155 | targets = ( 156 | 892FDEB01EB2153D00B1A333 /* Example-iOS */, 157 | ); 158 | }; 159 | /* End PBXProject section */ 160 | 161 | /* Begin PBXResourcesBuildPhase section */ 162 | 892FDEAF1EB2153D00B1A333 /* Resources */ = { 163 | isa = PBXResourcesBuildPhase; 164 | buildActionMask = 2147483647; 165 | files = ( 166 | 892FDEBF1EB2153D00B1A333 /* LaunchScreen.storyboard in Resources */, 167 | 89D4A7761EB6BC000006E05D /* CellSky.xib in Resources */, 168 | 89D4A7741EB6BBE60006E05D /* CellSalmon.xib in Resources */, 169 | 892FDEBC1EB2153D00B1A333 /* Assets.xcassets in Resources */, 170 | 892FDEBA1EB2153D00B1A333 /* Main.storyboard in Resources */, 171 | ); 172 | runOnlyForDeploymentPostprocessing = 0; 173 | }; 174 | /* End PBXResourcesBuildPhase section */ 175 | 176 | /* Begin PBXShellScriptBuildPhase section */ 177 | 26A667C078D2F5E8EF6F8056 /* [CP] Check Pods Manifest.lock */ = { 178 | isa = PBXShellScriptBuildPhase; 179 | buildActionMask = 2147483647; 180 | files = ( 181 | ); 182 | inputPaths = ( 183 | ); 184 | name = "[CP] Check Pods Manifest.lock"; 185 | outputPaths = ( 186 | ); 187 | runOnlyForDeploymentPostprocessing = 0; 188 | shellPath = /bin/sh; 189 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; 190 | showEnvVarsInLog = 0; 191 | }; 192 | 2B6997793C52BCB6886BD793 /* [CP] Embed Pods Frameworks */ = { 193 | isa = PBXShellScriptBuildPhase; 194 | buildActionMask = 2147483647; 195 | files = ( 196 | ); 197 | inputPaths = ( 198 | ); 199 | name = "[CP] Embed Pods Frameworks"; 200 | outputPaths = ( 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | shellPath = /bin/sh; 204 | shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-Example-iOS/Pods-Example-iOS-frameworks.sh\"\n"; 205 | showEnvVarsInLog = 0; 206 | }; 207 | 75DBE7C2C804007FA45E70A4 /* [CP] Copy Pods Resources */ = { 208 | isa = PBXShellScriptBuildPhase; 209 | buildActionMask = 2147483647; 210 | files = ( 211 | ); 212 | inputPaths = ( 213 | ); 214 | name = "[CP] Copy Pods Resources"; 215 | outputPaths = ( 216 | ); 217 | runOnlyForDeploymentPostprocessing = 0; 218 | shellPath = /bin/sh; 219 | shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-Example-iOS/Pods-Example-iOS-resources.sh\"\n"; 220 | showEnvVarsInLog = 0; 221 | }; 222 | /* End PBXShellScriptBuildPhase section */ 223 | 224 | /* Begin PBXSourcesBuildPhase section */ 225 | 892FDEAD1EB2153D00B1A333 /* Sources */ = { 226 | isa = PBXSourcesBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | 89D4A76E1EB6BAA90006E05D /* CellSalmon.swift in Sources */, 230 | 892FDEB71EB2153D00B1A333 /* ViewController.swift in Sources */, 231 | 892FDEB51EB2153D00B1A333 /* AppDelegate.swift in Sources */, 232 | 89D4A7721EB6BB5B0006E05D /* CellSky.swift in Sources */, 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | /* End PBXSourcesBuildPhase section */ 237 | 238 | /* Begin PBXVariantGroup section */ 239 | 892FDEB81EB2153D00B1A333 /* Main.storyboard */ = { 240 | isa = PBXVariantGroup; 241 | children = ( 242 | 892FDEB91EB2153D00B1A333 /* Base */, 243 | ); 244 | name = Main.storyboard; 245 | sourceTree = ""; 246 | }; 247 | 892FDEBD1EB2153D00B1A333 /* LaunchScreen.storyboard */ = { 248 | isa = PBXVariantGroup; 249 | children = ( 250 | 892FDEBE1EB2153D00B1A333 /* Base */, 251 | ); 252 | name = LaunchScreen.storyboard; 253 | sourceTree = ""; 254 | }; 255 | /* End PBXVariantGroup section */ 256 | 257 | /* Begin XCBuildConfiguration section */ 258 | 892FDEC11EB2153D00B1A333 /* Debug */ = { 259 | isa = XCBuildConfiguration; 260 | buildSettings = { 261 | ALWAYS_SEARCH_USER_PATHS = NO; 262 | CLANG_ANALYZER_NONNULL = YES; 263 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 264 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 265 | CLANG_CXX_LIBRARY = "libc++"; 266 | CLANG_ENABLE_MODULES = YES; 267 | CLANG_ENABLE_OBJC_ARC = YES; 268 | CLANG_WARN_BOOL_CONVERSION = YES; 269 | CLANG_WARN_CONSTANT_CONVERSION = YES; 270 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 271 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 272 | CLANG_WARN_EMPTY_BODY = YES; 273 | CLANG_WARN_ENUM_CONVERSION = YES; 274 | CLANG_WARN_INFINITE_RECURSION = YES; 275 | CLANG_WARN_INT_CONVERSION = YES; 276 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 277 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 278 | CLANG_WARN_UNREACHABLE_CODE = YES; 279 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 280 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 281 | COPY_PHASE_STRIP = NO; 282 | DEBUG_INFORMATION_FORMAT = dwarf; 283 | ENABLE_STRICT_OBJC_MSGSEND = YES; 284 | ENABLE_TESTABILITY = YES; 285 | GCC_C_LANGUAGE_STANDARD = gnu99; 286 | GCC_DYNAMIC_NO_PIC = NO; 287 | GCC_NO_COMMON_BLOCKS = YES; 288 | GCC_OPTIMIZATION_LEVEL = 0; 289 | GCC_PREPROCESSOR_DEFINITIONS = ( 290 | "DEBUG=1", 291 | "$(inherited)", 292 | ); 293 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 294 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 295 | GCC_WARN_UNDECLARED_SELECTOR = YES; 296 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 297 | GCC_WARN_UNUSED_FUNCTION = YES; 298 | GCC_WARN_UNUSED_VARIABLE = YES; 299 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 300 | MTL_ENABLE_DEBUG_INFO = YES; 301 | ONLY_ACTIVE_ARCH = YES; 302 | SDKROOT = iphoneos; 303 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 304 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 305 | TARGETED_DEVICE_FAMILY = "1,2"; 306 | }; 307 | name = Debug; 308 | }; 309 | 892FDEC21EB2153D00B1A333 /* Release */ = { 310 | isa = XCBuildConfiguration; 311 | buildSettings = { 312 | ALWAYS_SEARCH_USER_PATHS = NO; 313 | CLANG_ANALYZER_NONNULL = YES; 314 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 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_DOCUMENTATION_COMMENTS = YES; 323 | CLANG_WARN_EMPTY_BODY = YES; 324 | CLANG_WARN_ENUM_CONVERSION = YES; 325 | CLANG_WARN_INFINITE_RECURSION = YES; 326 | CLANG_WARN_INT_CONVERSION = YES; 327 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 328 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 329 | CLANG_WARN_UNREACHABLE_CODE = YES; 330 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 331 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 332 | COPY_PHASE_STRIP = NO; 333 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 334 | ENABLE_NS_ASSERTIONS = NO; 335 | ENABLE_STRICT_OBJC_MSGSEND = YES; 336 | GCC_C_LANGUAGE_STANDARD = gnu99; 337 | GCC_NO_COMMON_BLOCKS = YES; 338 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 339 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 340 | GCC_WARN_UNDECLARED_SELECTOR = YES; 341 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 342 | GCC_WARN_UNUSED_FUNCTION = YES; 343 | GCC_WARN_UNUSED_VARIABLE = YES; 344 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 345 | MTL_ENABLE_DEBUG_INFO = NO; 346 | SDKROOT = iphoneos; 347 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 348 | TARGETED_DEVICE_FAMILY = "1,2"; 349 | VALIDATE_PRODUCT = YES; 350 | }; 351 | name = Release; 352 | }; 353 | 892FDEC41EB2153D00B1A333 /* Debug */ = { 354 | isa = XCBuildConfiguration; 355 | baseConfigurationReference = CA760D93AB523E1177AFF660 /* Pods-Example-iOS.debug.xcconfig */; 356 | buildSettings = { 357 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 358 | DEVELOPMENT_TEAM = 56KUK57QCP; 359 | INFOPLIST_FILE = "Example-iOS/Info.plist"; 360 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 361 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 362 | PRODUCT_BUNDLE_IDENTIFIER = "macabeus.Example-iOS"; 363 | PRODUCT_NAME = "$(TARGET_NAME)"; 364 | SWIFT_VERSION = 3.0; 365 | }; 366 | name = Debug; 367 | }; 368 | 892FDEC51EB2153D00B1A333 /* Release */ = { 369 | isa = XCBuildConfiguration; 370 | baseConfigurationReference = 9E1E11BF60A682EFA54521CF /* Pods-Example-iOS.release.xcconfig */; 371 | buildSettings = { 372 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 373 | DEVELOPMENT_TEAM = 56KUK57QCP; 374 | INFOPLIST_FILE = "Example-iOS/Info.plist"; 375 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 376 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 377 | PRODUCT_BUNDLE_IDENTIFIER = "macabeus.Example-iOS"; 378 | PRODUCT_NAME = "$(TARGET_NAME)"; 379 | SWIFT_VERSION = 3.0; 380 | }; 381 | name = Release; 382 | }; 383 | /* End XCBuildConfiguration section */ 384 | 385 | /* Begin XCConfigurationList section */ 386 | 892FDEAC1EB2153D00B1A333 /* Build configuration list for PBXProject "Example-iOS" */ = { 387 | isa = XCConfigurationList; 388 | buildConfigurations = ( 389 | 892FDEC11EB2153D00B1A333 /* Debug */, 390 | 892FDEC21EB2153D00B1A333 /* Release */, 391 | ); 392 | defaultConfigurationIsVisible = 0; 393 | defaultConfigurationName = Release; 394 | }; 395 | 892FDEC31EB2153D00B1A333 /* Build configuration list for PBXNativeTarget "Example-iOS" */ = { 396 | isa = XCConfigurationList; 397 | buildConfigurations = ( 398 | 892FDEC41EB2153D00B1A333 /* Debug */, 399 | 892FDEC51EB2153D00B1A333 /* Release */, 400 | ); 401 | defaultConfigurationIsVisible = 0; 402 | defaultConfigurationName = Release; 403 | }; 404 | /* End XCConfigurationList section */ 405 | }; 406 | rootObject = 892FDEA91EB2153D00B1A333 /* Project object */; 407 | } 408 | -------------------------------------------------------------------------------- /Example-iOS/Example-iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example-iOS/Example-iOS/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Example-iOS 4 | // 5 | // Created by Bruno Macabeus Aquino on 27/04/17. 6 | // Copyright © 2017 Bruno Macabeus Aquino. 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: [UIApplicationLaunchOptionsKey: Any]?) -> 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 invalidate graphics rendering callbacks. 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 active 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 | -------------------------------------------------------------------------------- /Example-iOS/Example-iOS/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 | } -------------------------------------------------------------------------------- /Example-iOS/Example-iOS/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 | -------------------------------------------------------------------------------- /Example-iOS/Example-iOS/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 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /Example-iOS/Example-iOS/CellSalmon.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CellRed.swift 3 | // Example-iOS 4 | // 5 | // Created by Bruno Macabeus Aquino on 30/04/17. 6 | // Copyright © 2017 Bruno Macabeus Aquino. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import GridView 11 | 12 | class CellSalmon: UICollectionViewCell, SlotableCell { 13 | 14 | static let slotWidth = 2 15 | static let slotHeight = 1 16 | static let myNib = UINib(nibName: "CellSalmon", bundle: nil) 17 | var slotParams: [String : Any] = [:] 18 | 19 | func load() { 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Example-iOS/Example-iOS/CellSalmon.xib: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Example-iOS/Example-iOS/CellSky.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CellSky.swift 3 | // Example-iOS 4 | // 5 | // Created by Bruno Macabeus Aquino on 30/04/17. 6 | // Copyright © 2017 Bruno Macabeus Aquino. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import GridView 11 | 12 | class CellSky: UICollectionViewCell, SlotableCell { 13 | 14 | static let slotWidth = 1 15 | static let slotHeight = 1 16 | static let myNib = UINib(nibName: "CellSky", bundle: nil) 17 | var slotParams: [String : Any] = [:] 18 | 19 | func load() { 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Example-iOS/Example-iOS/CellSky.xib: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Example-iOS/Example-iOS/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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Example-iOS/Example-iOS/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Example-iOS 4 | // 5 | // Created by Bruno Macabeus Aquino on 27/04/17. 6 | // Copyright © 2017 Bruno Macabeus Aquino. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import GridView 11 | 12 | // ⚠️ please, read code in Example-tvOS, because this is more complete ⚠️ 13 | 14 | class ViewController: UIViewController { 15 | 16 | @IBOutlet weak var container: UIView! 17 | var containerGrid: GridViewController? 18 | 19 | override func viewDidLoad() { 20 | super.viewDidLoad() 21 | 22 | containerGrid!.gridConfiguration = GridConfiguration.create(slots: Slots(slots: [ 23 | [Slot(cell: CellSalmon.self, params: [:])], 24 | [Slot(cell: CellSky.self, params: [:]), Slot(cell: CellSky.self, params: [:])] 25 | ])) 26 | } 27 | 28 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 29 | 30 | if segue.identifier == "segueGrid" { 31 | self.containerGrid = (segue.destination as! GridViewController) 32 | self.containerGrid!.delegate = self 33 | } 34 | } 35 | } 36 | 37 | extension ViewController: GridViewDelegate { 38 | func getCellToRegister() -> [SlotableCell.Type] { 39 | return [CellSalmon.self, CellSky.self] 40 | } 41 | 42 | func setup(cell: SlotableCell) { 43 | (cell as? UICollectionViewCell)?.layer.cornerRadius = 10 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 892FDE9A1EB2152600B1A333 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892FDE991EB2152600B1A333 /* AppDelegate.swift */; }; 11 | 892FDE9C1EB2152600B1A333 /* MainTvController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892FDE9B1EB2152600B1A333 /* MainTvController.swift */; }; 12 | 892FDE9F1EB2152600B1A333 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 892FDE9D1EB2152600B1A333 /* Main.storyboard */; }; 13 | 892FDEA11EB2152600B1A333 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 892FDEA01EB2152600B1A333 /* Assets.xcassets */; }; 14 | 892FDF621EB3959E00B1A333 /* CellCharacter.xib in Resources */ = {isa = PBXBuildFile; fileRef = 892FDF611EB3959E00B1A333 /* CellCharacter.xib */; }; 15 | 892FDF641EB395B300B1A333 /* CellLogs.xib in Resources */ = {isa = PBXBuildFile; fileRef = 892FDF631EB395B300B1A333 /* CellLogs.xib */; }; 16 | 892FDF661EB396A800B1A333 /* CellCharacter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892FDF651EB396A800B1A333 /* CellCharacter.swift */; }; 17 | 892FDF681EB396CD00B1A333 /* CellLogs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892FDF671EB396CD00B1A333 /* CellLogs.swift */; }; 18 | 892FDF6A1EB3CC2300B1A333 /* CellMap.xib in Resources */ = {isa = PBXBuildFile; fileRef = 892FDF691EB3CC2300B1A333 /* CellMap.xib */; }; 19 | 892FDF6C1EB3CC4500B1A333 /* CellMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892FDF6B1EB3CC4500B1A333 /* CellMap.swift */; }; 20 | 892FDF6E1EB3DE9100B1A333 /* CellChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892FDF6D1EB3DE9100B1A333 /* CellChart.swift */; }; 21 | 892FDF701EB3DE9D00B1A333 /* CellChart.xib in Resources */ = {isa = PBXBuildFile; fileRef = 892FDF6F1EB3DE9D00B1A333 /* CellChart.xib */; }; 22 | 89D4A7781EB6D6E70006E05D /* ProtocolCellRealTime.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89D4A7771EB6D6E70006E05D /* ProtocolCellRealTime.swift */; }; 23 | A52F657142C2419BE8CB666C /* Pods_Example_tvOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 88CD958C69AD4EC72E1F693D /* Pods_Example_tvOS.framework */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 536EEC1959BF8DAFB43D9F2F /* Pods-Example-tvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-tvOS.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-Example-tvOS/Pods-Example-tvOS.debug.xcconfig"; sourceTree = ""; }; 28 | 8555ACF6AFB9455CEB797522 /* Pods-Example-tvOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example-tvOS.release.xcconfig"; path = "../Pods/Target Support Files/Pods-Example-tvOS/Pods-Example-tvOS.release.xcconfig"; sourceTree = ""; }; 29 | 88CD958C69AD4EC72E1F693D /* Pods_Example_tvOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example_tvOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 892FDE961EB2152600B1A333 /* Example-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Example-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 892FDE991EB2152600B1A333 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 32 | 892FDE9B1EB2152600B1A333 /* MainTvController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTvController.swift; sourceTree = ""; }; 33 | 892FDE9E1EB2152600B1A333 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 34 | 892FDEA01EB2152600B1A333 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 35 | 892FDEA21EB2152600B1A333 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | 892FDF611EB3959E00B1A333 /* CellCharacter.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CellCharacter.xib; sourceTree = ""; }; 37 | 892FDF631EB395B300B1A333 /* CellLogs.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CellLogs.xib; sourceTree = ""; }; 38 | 892FDF651EB396A800B1A333 /* CellCharacter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CellCharacter.swift; sourceTree = ""; }; 39 | 892FDF671EB396CD00B1A333 /* CellLogs.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CellLogs.swift; sourceTree = ""; }; 40 | 892FDF691EB3CC2300B1A333 /* CellMap.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CellMap.xib; sourceTree = ""; }; 41 | 892FDF6B1EB3CC4500B1A333 /* CellMap.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CellMap.swift; sourceTree = ""; }; 42 | 892FDF6D1EB3DE9100B1A333 /* CellChart.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CellChart.swift; sourceTree = ""; }; 43 | 892FDF6F1EB3DE9D00B1A333 /* CellChart.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CellChart.xib; sourceTree = ""; }; 44 | 89D4A7771EB6D6E70006E05D /* ProtocolCellRealTime.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProtocolCellRealTime.swift; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 892FDE931EB2152600B1A333 /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | A52F657142C2419BE8CB666C /* Pods_Example_tvOS.framework in Frameworks */, 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | /* End PBXFrameworksBuildPhase section */ 57 | 58 | /* Begin PBXGroup section */ 59 | 892FDE8D1EB2152600B1A333 = { 60 | isa = PBXGroup; 61 | children = ( 62 | 892FDE981EB2152600B1A333 /* Example-tvOS */, 63 | 892FDE971EB2152600B1A333 /* Products */, 64 | FE8C3F42BD395E407121D73D /* Pods */, 65 | DB1F4469CE8AE1367958B68F /* Frameworks */, 66 | ); 67 | sourceTree = ""; 68 | }; 69 | 892FDE971EB2152600B1A333 /* Products */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 892FDE961EB2152600B1A333 /* Example-tvOS.app */, 73 | ); 74 | name = Products; 75 | sourceTree = ""; 76 | }; 77 | 892FDE981EB2152600B1A333 /* Example-tvOS */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 892FDE991EB2152600B1A333 /* AppDelegate.swift */, 81 | 892FDE9B1EB2152600B1A333 /* MainTvController.swift */, 82 | 892FDF691EB3CC2300B1A333 /* CellMap.xib */, 83 | 892FDF6B1EB3CC4500B1A333 /* CellMap.swift */, 84 | 892FDF631EB395B300B1A333 /* CellLogs.xib */, 85 | 892FDF671EB396CD00B1A333 /* CellLogs.swift */, 86 | 892FDF6F1EB3DE9D00B1A333 /* CellChart.xib */, 87 | 892FDF6D1EB3DE9100B1A333 /* CellChart.swift */, 88 | 892FDF611EB3959E00B1A333 /* CellCharacter.xib */, 89 | 892FDF651EB396A800B1A333 /* CellCharacter.swift */, 90 | 89D4A7771EB6D6E70006E05D /* ProtocolCellRealTime.swift */, 91 | 892FDE9D1EB2152600B1A333 /* Main.storyboard */, 92 | 892FDEA01EB2152600B1A333 /* Assets.xcassets */, 93 | 892FDEA21EB2152600B1A333 /* Info.plist */, 94 | ); 95 | path = "Example-tvOS"; 96 | sourceTree = ""; 97 | }; 98 | DB1F4469CE8AE1367958B68F /* Frameworks */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 88CD958C69AD4EC72E1F693D /* Pods_Example_tvOS.framework */, 102 | ); 103 | name = Frameworks; 104 | sourceTree = ""; 105 | }; 106 | FE8C3F42BD395E407121D73D /* Pods */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 536EEC1959BF8DAFB43D9F2F /* Pods-Example-tvOS.debug.xcconfig */, 110 | 8555ACF6AFB9455CEB797522 /* Pods-Example-tvOS.release.xcconfig */, 111 | ); 112 | name = Pods; 113 | sourceTree = ""; 114 | }; 115 | /* End PBXGroup section */ 116 | 117 | /* Begin PBXNativeTarget section */ 118 | 892FDE951EB2152600B1A333 /* Example-tvOS */ = { 119 | isa = PBXNativeTarget; 120 | buildConfigurationList = 892FDEA51EB2152600B1A333 /* Build configuration list for PBXNativeTarget "Example-tvOS" */; 121 | buildPhases = ( 122 | A880A6BB8D8244DFFC7F6B7C /* [CP] Check Pods Manifest.lock */, 123 | 892FDE921EB2152600B1A333 /* Sources */, 124 | 892FDE931EB2152600B1A333 /* Frameworks */, 125 | 892FDE941EB2152600B1A333 /* Resources */, 126 | 01C601B60E40D6D49C53E1EE /* [CP] Embed Pods Frameworks */, 127 | 75F571E9807DB5A30DC8C41D /* [CP] Copy Pods Resources */, 128 | ); 129 | buildRules = ( 130 | ); 131 | dependencies = ( 132 | ); 133 | name = "Example-tvOS"; 134 | productName = "Example-tvOS"; 135 | productReference = 892FDE961EB2152600B1A333 /* Example-tvOS.app */; 136 | productType = "com.apple.product-type.application"; 137 | }; 138 | /* End PBXNativeTarget section */ 139 | 140 | /* Begin PBXProject section */ 141 | 892FDE8E1EB2152600B1A333 /* Project object */ = { 142 | isa = PBXProject; 143 | attributes = { 144 | LastSwiftUpdateCheck = 0830; 145 | LastUpgradeCheck = 0830; 146 | ORGANIZATIONNAME = "Bruno Macabeus Aquino"; 147 | TargetAttributes = { 148 | 892FDE951EB2152600B1A333 = { 149 | CreatedOnToolsVersion = 8.3; 150 | DevelopmentTeam = 56KUK57QCP; 151 | ProvisioningStyle = Automatic; 152 | }; 153 | }; 154 | }; 155 | buildConfigurationList = 892FDE911EB2152600B1A333 /* Build configuration list for PBXProject "Example-tvOS" */; 156 | compatibilityVersion = "Xcode 3.2"; 157 | developmentRegion = English; 158 | hasScannedForEncodings = 0; 159 | knownRegions = ( 160 | en, 161 | Base, 162 | ); 163 | mainGroup = 892FDE8D1EB2152600B1A333; 164 | productRefGroup = 892FDE971EB2152600B1A333 /* Products */; 165 | projectDirPath = ""; 166 | projectRoot = ""; 167 | targets = ( 168 | 892FDE951EB2152600B1A333 /* Example-tvOS */, 169 | ); 170 | }; 171 | /* End PBXProject section */ 172 | 173 | /* Begin PBXResourcesBuildPhase section */ 174 | 892FDE941EB2152600B1A333 /* Resources */ = { 175 | isa = PBXResourcesBuildPhase; 176 | buildActionMask = 2147483647; 177 | files = ( 178 | 892FDF641EB395B300B1A333 /* CellLogs.xib in Resources */, 179 | 892FDEA11EB2152600B1A333 /* Assets.xcassets in Resources */, 180 | 892FDF701EB3DE9D00B1A333 /* CellChart.xib in Resources */, 181 | 892FDE9F1EB2152600B1A333 /* Main.storyboard in Resources */, 182 | 892FDF621EB3959E00B1A333 /* CellCharacter.xib in Resources */, 183 | 892FDF6A1EB3CC2300B1A333 /* CellMap.xib in Resources */, 184 | ); 185 | runOnlyForDeploymentPostprocessing = 0; 186 | }; 187 | /* End PBXResourcesBuildPhase section */ 188 | 189 | /* Begin PBXShellScriptBuildPhase section */ 190 | 01C601B60E40D6D49C53E1EE /* [CP] Embed Pods Frameworks */ = { 191 | isa = PBXShellScriptBuildPhase; 192 | buildActionMask = 2147483647; 193 | files = ( 194 | ); 195 | inputPaths = ( 196 | ); 197 | name = "[CP] Embed Pods Frameworks"; 198 | outputPaths = ( 199 | ); 200 | runOnlyForDeploymentPostprocessing = 0; 201 | shellPath = /bin/sh; 202 | shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-Example-tvOS/Pods-Example-tvOS-frameworks.sh\"\n"; 203 | showEnvVarsInLog = 0; 204 | }; 205 | 75F571E9807DB5A30DC8C41D /* [CP] Copy Pods Resources */ = { 206 | isa = PBXShellScriptBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | ); 210 | inputPaths = ( 211 | ); 212 | name = "[CP] Copy Pods Resources"; 213 | outputPaths = ( 214 | ); 215 | runOnlyForDeploymentPostprocessing = 0; 216 | shellPath = /bin/sh; 217 | shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-Example-tvOS/Pods-Example-tvOS-resources.sh\"\n"; 218 | showEnvVarsInLog = 0; 219 | }; 220 | A880A6BB8D8244DFFC7F6B7C /* [CP] Check Pods Manifest.lock */ = { 221 | isa = PBXShellScriptBuildPhase; 222 | buildActionMask = 2147483647; 223 | files = ( 224 | ); 225 | inputPaths = ( 226 | ); 227 | name = "[CP] Check Pods Manifest.lock"; 228 | outputPaths = ( 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | shellPath = /bin/sh; 232 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; 233 | showEnvVarsInLog = 0; 234 | }; 235 | /* End PBXShellScriptBuildPhase section */ 236 | 237 | /* Begin PBXSourcesBuildPhase section */ 238 | 892FDE921EB2152600B1A333 /* Sources */ = { 239 | isa = PBXSourcesBuildPhase; 240 | buildActionMask = 2147483647; 241 | files = ( 242 | 892FDF681EB396CD00B1A333 /* CellLogs.swift in Sources */, 243 | 892FDE9C1EB2152600B1A333 /* MainTvController.swift in Sources */, 244 | 892FDF661EB396A800B1A333 /* CellCharacter.swift in Sources */, 245 | 89D4A7781EB6D6E70006E05D /* ProtocolCellRealTime.swift in Sources */, 246 | 892FDE9A1EB2152600B1A333 /* AppDelegate.swift in Sources */, 247 | 892FDF6E1EB3DE9100B1A333 /* CellChart.swift in Sources */, 248 | 892FDF6C1EB3CC4500B1A333 /* CellMap.swift in Sources */, 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | /* End PBXSourcesBuildPhase section */ 253 | 254 | /* Begin PBXVariantGroup section */ 255 | 892FDE9D1EB2152600B1A333 /* Main.storyboard */ = { 256 | isa = PBXVariantGroup; 257 | children = ( 258 | 892FDE9E1EB2152600B1A333 /* Base */, 259 | ); 260 | name = Main.storyboard; 261 | sourceTree = ""; 262 | }; 263 | /* End PBXVariantGroup section */ 264 | 265 | /* Begin XCBuildConfiguration section */ 266 | 892FDEA31EB2152600B1A333 /* Debug */ = { 267 | isa = XCBuildConfiguration; 268 | buildSettings = { 269 | ALWAYS_SEARCH_USER_PATHS = NO; 270 | CLANG_ANALYZER_NONNULL = YES; 271 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 272 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 273 | CLANG_CXX_LIBRARY = "libc++"; 274 | CLANG_ENABLE_MODULES = YES; 275 | CLANG_ENABLE_OBJC_ARC = YES; 276 | CLANG_WARN_BOOL_CONVERSION = YES; 277 | CLANG_WARN_CONSTANT_CONVERSION = YES; 278 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 279 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 280 | CLANG_WARN_EMPTY_BODY = YES; 281 | CLANG_WARN_ENUM_CONVERSION = YES; 282 | CLANG_WARN_INFINITE_RECURSION = YES; 283 | CLANG_WARN_INT_CONVERSION = YES; 284 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 285 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 286 | CLANG_WARN_UNREACHABLE_CODE = YES; 287 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 288 | COPY_PHASE_STRIP = NO; 289 | DEBUG_INFORMATION_FORMAT = dwarf; 290 | ENABLE_STRICT_OBJC_MSGSEND = YES; 291 | ENABLE_TESTABILITY = YES; 292 | GCC_C_LANGUAGE_STANDARD = gnu99; 293 | GCC_DYNAMIC_NO_PIC = NO; 294 | GCC_NO_COMMON_BLOCKS = YES; 295 | GCC_OPTIMIZATION_LEVEL = 0; 296 | GCC_PREPROCESSOR_DEFINITIONS = ( 297 | "DEBUG=1", 298 | "$(inherited)", 299 | ); 300 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 301 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 302 | GCC_WARN_UNDECLARED_SELECTOR = YES; 303 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 304 | GCC_WARN_UNUSED_FUNCTION = YES; 305 | GCC_WARN_UNUSED_VARIABLE = YES; 306 | MTL_ENABLE_DEBUG_INFO = YES; 307 | ONLY_ACTIVE_ARCH = YES; 308 | SDKROOT = appletvos; 309 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 310 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 311 | TARGETED_DEVICE_FAMILY = 3; 312 | TVOS_DEPLOYMENT_TARGET = 10.2; 313 | }; 314 | name = Debug; 315 | }; 316 | 892FDEA41EB2152600B1A333 /* Release */ = { 317 | isa = XCBuildConfiguration; 318 | buildSettings = { 319 | ALWAYS_SEARCH_USER_PATHS = NO; 320 | CLANG_ANALYZER_NONNULL = YES; 321 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 322 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 323 | CLANG_CXX_LIBRARY = "libc++"; 324 | CLANG_ENABLE_MODULES = YES; 325 | CLANG_ENABLE_OBJC_ARC = YES; 326 | CLANG_WARN_BOOL_CONVERSION = YES; 327 | CLANG_WARN_CONSTANT_CONVERSION = YES; 328 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 329 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 330 | CLANG_WARN_EMPTY_BODY = YES; 331 | CLANG_WARN_ENUM_CONVERSION = YES; 332 | CLANG_WARN_INFINITE_RECURSION = YES; 333 | CLANG_WARN_INT_CONVERSION = YES; 334 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 335 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 336 | CLANG_WARN_UNREACHABLE_CODE = YES; 337 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 338 | COPY_PHASE_STRIP = NO; 339 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 340 | ENABLE_NS_ASSERTIONS = NO; 341 | ENABLE_STRICT_OBJC_MSGSEND = YES; 342 | GCC_C_LANGUAGE_STANDARD = gnu99; 343 | GCC_NO_COMMON_BLOCKS = YES; 344 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 345 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 346 | GCC_WARN_UNDECLARED_SELECTOR = YES; 347 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 348 | GCC_WARN_UNUSED_FUNCTION = YES; 349 | GCC_WARN_UNUSED_VARIABLE = YES; 350 | MTL_ENABLE_DEBUG_INFO = NO; 351 | SDKROOT = appletvos; 352 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 353 | TARGETED_DEVICE_FAMILY = 3; 354 | TVOS_DEPLOYMENT_TARGET = 10.2; 355 | VALIDATE_PRODUCT = YES; 356 | }; 357 | name = Release; 358 | }; 359 | 892FDEA61EB2152600B1A333 /* Debug */ = { 360 | isa = XCBuildConfiguration; 361 | baseConfigurationReference = 536EEC1959BF8DAFB43D9F2F /* Pods-Example-tvOS.debug.xcconfig */; 362 | buildSettings = { 363 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; 364 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 365 | DEVELOPMENT_TEAM = 56KUK57QCP; 366 | INFOPLIST_FILE = "Example-tvOS/Info.plist"; 367 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 368 | PRODUCT_BUNDLE_IDENTIFIER = "macabeus.Example-tvOS"; 369 | PRODUCT_NAME = "$(TARGET_NAME)"; 370 | SWIFT_VERSION = 3.0; 371 | TVOS_DEPLOYMENT_TARGET = 10.2; 372 | }; 373 | name = Debug; 374 | }; 375 | 892FDEA71EB2152600B1A333 /* Release */ = { 376 | isa = XCBuildConfiguration; 377 | baseConfigurationReference = 8555ACF6AFB9455CEB797522 /* Pods-Example-tvOS.release.xcconfig */; 378 | buildSettings = { 379 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; 380 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 381 | DEVELOPMENT_TEAM = 56KUK57QCP; 382 | INFOPLIST_FILE = "Example-tvOS/Info.plist"; 383 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 384 | PRODUCT_BUNDLE_IDENTIFIER = "macabeus.Example-tvOS"; 385 | PRODUCT_NAME = "$(TARGET_NAME)"; 386 | SWIFT_VERSION = 3.0; 387 | TVOS_DEPLOYMENT_TARGET = 10.2; 388 | }; 389 | name = Release; 390 | }; 391 | /* End XCBuildConfiguration section */ 392 | 393 | /* Begin XCConfigurationList section */ 394 | 892FDE911EB2152600B1A333 /* Build configuration list for PBXProject "Example-tvOS" */ = { 395 | isa = XCConfigurationList; 396 | buildConfigurations = ( 397 | 892FDEA31EB2152600B1A333 /* Debug */, 398 | 892FDEA41EB2152600B1A333 /* Release */, 399 | ); 400 | defaultConfigurationIsVisible = 0; 401 | defaultConfigurationName = Release; 402 | }; 403 | 892FDEA51EB2152600B1A333 /* Build configuration list for PBXNativeTarget "Example-tvOS" */ = { 404 | isa = XCConfigurationList; 405 | buildConfigurations = ( 406 | 892FDEA61EB2152600B1A333 /* Debug */, 407 | 892FDEA71EB2152600B1A333 /* Release */, 408 | ); 409 | defaultConfigurationIsVisible = 0; 410 | defaultConfigurationName = Release; 411 | }; 412 | /* End XCConfigurationList section */ 413 | }; 414 | rootObject = 892FDE8E1EB2152600B1A333 /* Project object */; 415 | } 416 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Example-tvOS 4 | // 5 | // Created by Bruno Macabeus Aquino on 27/04/17. 6 | // Copyright © 2017 Bruno Macabeus Aquino. 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: [UIApplicationLaunchOptionsKey: Any]?) -> 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 active 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 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "layers" : [ 3 | { 4 | "filename" : "Front.imagestacklayer" 5 | }, 6 | { 7 | "filename" : "Middle.imagestacklayer" 8 | }, 9 | { 10 | "filename" : "Back.imagestacklayer" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "layers" : [ 3 | { 4 | "filename" : "Front.imagestacklayer" 5 | }, 6 | { 7 | "filename" : "Middle.imagestacklayer" 8 | }, 9 | { 10 | "filename" : "Back.imagestacklayer" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "assets" : [ 3 | { 4 | "size" : "1280x768", 5 | "idiom" : "tv", 6 | "filename" : "App Icon - Large.imagestack", 7 | "role" : "primary-app-icon" 8 | }, 9 | { 10 | "size" : "400x240", 11 | "idiom" : "tv", 12 | "filename" : "App Icon - Small.imagestack", 13 | "role" : "primary-app-icon" 14 | }, 15 | { 16 | "size" : "2320x720", 17 | "idiom" : "tv", 18 | "filename" : "Top Shelf Image Wide.imageset", 19 | "role" : "top-shelf-image-wide" 20 | }, 21 | { 22 | "size" : "1920x720", 23 | "idiom" : "tv", 24 | "filename" : "Top Shelf Image.imageset", 25 | "role" : "top-shelf-image" 26 | } 27 | ], 28 | "info" : { 29 | "version" : 1, 30 | "author" : "xcode" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "landscape", 5 | "idiom" : "tv", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "9.0", 8 | "scale" : "1x" 9 | } 10 | ], 11 | "info" : { 12 | "version" : 1, 13 | "author" : "xcode" 14 | } 15 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/chart.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "html5_live_chart.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 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/chart.imageset/html5_live_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macabeus/GridView/3b04d750775602312db5c26762a53168211ff359/Example-tvOS/Example-tvOS/Assets.xcassets/chart.imageset/html5_live_chart.png -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/elves.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "druid.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 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/elves.imageset/druid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macabeus/GridView/3b04d750775602312db5c26762a53168211ff359/Example-tvOS/Example-tvOS/Assets.xcassets/elves.imageset/druid.png -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/map.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Screen Shot 2017-04-28 at 18.00.54.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 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/map.imageset/Screen Shot 2017-04-28 at 18.00.54.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macabeus/GridView/3b04d750775602312db5c26762a53168211ff359/Example-tvOS/Example-tvOS/Assets.xcassets/map.imageset/Screen Shot 2017-04-28 at 18.00.54.png -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/merfolk.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "merfolk.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 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/merfolk.imageset/merfolk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macabeus/GridView/3b04d750775602312db5c26762a53168211ff359/Example-tvOS/Example-tvOS/Assets.xcassets/merfolk.imageset/merfolk.png -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/troll.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "troll.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 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/troll.imageset/troll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macabeus/GridView/3b04d750775602312db5c26762a53168211ff359/Example-tvOS/Example-tvOS/Assets.xcassets/troll.imageset/troll.png -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/undead.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "ghost.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 | } -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/Assets.xcassets/undead.imageset/ghost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/macabeus/GridView/3b04d750775602312db5c26762a53168211ff359/Example-tvOS/Example-tvOS/Assets.xcassets/undead.imageset/ghost.png -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/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 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/CellCharacter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CellCharacter.swift 3 | // Example-tvOS 4 | // 5 | // Created by Bruno Macabeus Aquino on 28/04/17. 6 | // Copyright © 2017 Bruno Macabeus Aquino. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import GridView 11 | 12 | class CellCharacter: UICollectionViewCell, SlotableCell { 13 | 14 | @IBOutlet weak var image: UIImageView! 15 | static let slotWidth = 1 16 | static let slotHeight = 1 17 | var slotParams: [String : Any] = [:] 18 | 19 | func load() { 20 | let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.dark) 21 | let blurEffectView = UIVisualEffectView(effect: blurEffect) 22 | blurEffectView.frame = backgroundView!.bounds 23 | blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight] 24 | backgroundView!.addSubview(blurEffectView) 25 | 26 | // 27 | let paramRace = slotParams["race"] as? String 28 | 29 | switch paramRace { // imagens from the amazing open source game Battle for Wesnoth 30 | case "undead"?: 31 | backgroundView!.backgroundColor = UIColor(patternImage: #imageLiteral(resourceName: "undead")) 32 | image.image = #imageLiteral(resourceName: "undead") 33 | case "elves"?: 34 | backgroundView!.backgroundColor = UIColor(patternImage: #imageLiteral(resourceName: "elves")) 35 | image.image = #imageLiteral(resourceName: "elves") 36 | case "merfolk"?: 37 | backgroundView!.backgroundColor = UIColor(patternImage: #imageLiteral(resourceName: "merfolk")) 38 | image.image = #imageLiteral(resourceName: "merfolk") 39 | case "troll"?: 40 | backgroundView!.backgroundColor = UIColor(patternImage: #imageLiteral(resourceName: "troll")) 41 | image.image = #imageLiteral(resourceName: "troll") 42 | default: 43 | print("invalid race: \(paramRace ?? "nil")") 44 | } 45 | 46 | image.contentMode = .topRight 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/CellCharacter.xib: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/CellChart.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CellChart.swift 3 | // Example-tvOS 4 | // 5 | // Created by Bruno Macabeus Aquino on 28/04/17. 6 | // Copyright © 2017 Bruno Macabeus Aquino. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import GridView 11 | 12 | class CellChart: UICollectionViewCell, SlotableCell { 13 | 14 | @IBOutlet weak var chart: UIImageView! 15 | static let slotWidth = 2 16 | static let slotHeight = 1 17 | var slotParams: [String : Any] = [:] 18 | 19 | func load() { 20 | chart.contentMode = .scaleAspectFill 21 | } 22 | } 23 | 24 | extension CellChart: CellRealTimeProtocol { 25 | func connect() { 26 | // connecting in my amazing server... 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/CellChart.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 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 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/CellLogs.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CellInsignia.swift 3 | // Example-tvOS 4 | // 5 | // Created by Bruno Macabeus Aquino on 28/04/17. 6 | // Copyright © 2017 Bruno Macabeus Aquino. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import GridView 11 | 12 | class CellLogs: UICollectionViewCell, SlotableCell { 13 | 14 | static let slotWidth = 2 15 | static let slotHeight = 1 16 | var slotParams: [String : Any] = [:] 17 | 18 | func load() { 19 | 20 | } 21 | } 22 | 23 | extension CellLogs: CellRealTimeProtocol { 24 | func connect() { 25 | // connecting in my amazing server... 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/CellLogs.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 457f 464c 0101 0001 0000 0000 0000 0000 25 | 0000010 0002 0003 0001 0000 8430 0804 0034 26 | 0000020 22ec 0000 0000 0034 0020 0008 0028 27 | 28 | 29 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/CellMap.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CellMap.swift 3 | // Example-tvOS 4 | // 5 | // Created by Bruno Macabeus Aquino on 28/04/17. 6 | // Copyright © 2017 Bruno Macabeus Aquino. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import GridView 11 | 12 | // if do you want that a cell to be displayed in the grid, you need to subscriber the SlotableCell protocol ⚠️ 13 | // The xib, and cell's indentifier in xib file, *need* have the same name of the class ⚠️ 14 | class CellMap: UICollectionViewCell, SlotableCell { 15 | 16 | @IBOutlet weak var image: UIImageView! 17 | static let slotWidth = 2 // size of cell in grid 18 | static let slotHeight = 2 // size of cell in grid 19 | var slotParams: [String : Any] = [:] 20 | 21 | func load() { 22 | // this method if called when a cell is created in grid 23 | // you can see a example more complete in CellCharacter 🏃 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/CellMap.xib: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIMainStoryboardFile 24 | Main 25 | UIRequiredDeviceCapabilities 26 | 27 | arm64 28 | 29 | UIUserInterfaceStyle 30 | Automatic 31 | 32 | 33 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/MainTvController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MainTvController.swift 3 | // Example-tvOS 4 | // 5 | // Created by Bruno Macabeus Aquino on 27/04/17. 6 | // Copyright © 2017 Bruno Macabeus Aquino. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import GridView 11 | 12 | class MainTvController: UIViewController { 13 | 14 | @IBOutlet weak var container: UIView! 15 | var containerGrid: GridViewController? 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | 20 | view.backgroundColor = #colorLiteral(red: 0.4756349325, green: 0.4756467342, blue: 0.4756404161, alpha: 1) 21 | 22 | // set the cells to show in grid 📌 23 | containerGrid!.gridConfiguration = GridConfiguration.create(slots: Slots(slots: [ 24 | [Slot(cell: CellMap.self, params: [:]), Slot(cell: CellChart.self, params: [:])], 25 | [Slot(cell: CellLogs.self, params: [:])], 26 | [Slot(cell: CellCharacter.self, params: ["race": "troll"]), Slot(cell: CellCharacter.self, params: ["race": "elves"]), Slot(cell: CellCharacter.self, params: ["race": "undead"]), Slot(cell: CellCharacter.self, params: ["race": "merfolk"])] 27 | ]) 28 | ) 29 | } 30 | 31 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 32 | 33 | if segue.identifier == "segueGrid" { 34 | self.containerGrid = (segue.destination as! GridViewController) 35 | self.containerGrid!.delegate = self 36 | } 37 | } 38 | } 39 | 40 | extension MainTvController: GridViewDelegate { 41 | func getCellToRegister() -> [SlotableCell.Type] { 42 | // we need register cell's class, then, send it's where 🖋 43 | return [CellCharacter.self, CellLogs.self, CellMap.self, CellChart.self] 44 | 45 | // if do you want list all classes that subscreber the SlotableCell protocol, you can read use this gist: https://gist.github.com/brunomacabeusbr/eea343bb9119b96eed3393e41dcda0c9 💜 46 | } 47 | 48 | func setup(cell: SlotableCell) { 49 | // this delegate is called in "collectionView(_:cellForItemAt)" from GridViewController 50 | // it's useful when we need to setup many cells with same code 🍡 51 | 52 | // for example, connect to server, if a cell need 53 | if let cellRealTime = cell as? CellRealTimeProtocol { 54 | cellRealTime.connect() 55 | } 56 | 57 | // for example, sey layout 58 | (cell as? UICollectionViewCell)?.layer.cornerRadius = 10 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Example-tvOS/Example-tvOS/ProtocolCellRealTime.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProtocolCellRealTime.swift 3 | // Example-tvOS 4 | // 5 | // Created by Bruno Macabeus Aquino on 30/04/17. 6 | // Copyright © 2017 Bruno Macabeus Aquino. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | protocol CellRealTimeProtocol { 12 | func connect() 13 | } 14 | -------------------------------------------------------------------------------- /GridView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "GridView" 3 | s.version = "0.1.3" 4 | s.summary = "Amazing grid view in your tvOS/iOS app" 5 | s.homepage = "https://github.com/brunomacabeusbr/GridView" 6 | s.license = { :type => "MIT", :file => "LICENSE" } 7 | s.author = { "Bruno Macabeus" => "bruno.macabeus@gmail.com" } 8 | 9 | s.ios.deployment_target = "10.3" 10 | s.tvos.deployment_target = "10.2" 11 | 12 | s.source = { :git => "https://github.com/brunomacabeusbr/GridView.git", :tag => s.version } 13 | s.source_files = "GridView/GridView/*.swift" 14 | 15 | end 16 | -------------------------------------------------------------------------------- /GridView.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /GridView/GridView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 400F8E3CD308C212BF3CAD06 /* Pods_GridViewiOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1BEF5A4FDDFB73F179A38AD8 /* Pods_GridViewiOS.framework */; }; 11 | 7A432967B3BBF52F96902CE3 /* Pods_GridViewtvOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C5870DE982E3356B44BE405 /* Pods_GridViewtvOS.framework */; }; 12 | 892FDF5C1EB38E3C00B1A333 /* GridLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892FDF5B1EB38E3C00B1A333 /* GridLayout.swift */; }; 13 | 892FDF5D1EB38E9100B1A333 /* GridLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892FDF5B1EB38E3C00B1A333 /* GridLayout.swift */; }; 14 | 892FDF5F1EB38F8700B1A333 /* GridController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892FDF5E1EB38F8700B1A333 /* GridController.swift */; }; 15 | 892FDF601EB38F9300B1A333 /* GridController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892FDF5E1EB38F8700B1A333 /* GridController.swift */; }; 16 | 89A764DC1F246EE0000F764C /* GridConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89A764DB1F246EE0000F764C /* GridConfiguration.swift */; }; 17 | 89A764DD1F246EF6000F764C /* GridConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89A764DB1F246EE0000F764C /* GridConfiguration.swift */; }; 18 | 89A764DF1F246F09000F764C /* Slot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89A764DE1F246F09000F764C /* Slot.swift */; }; 19 | 89A764E01F246F0E000F764C /* Slot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89A764DE1F246F09000F764C /* Slot.swift */; }; 20 | 89D4A77A1EB6EA4E0006E05D /* GridView.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 89D4A7791EB6EA4E0006E05D /* GridView.podspec */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXFileReference section */ 24 | 1BEF5A4FDDFB73F179A38AD8 /* Pods_GridViewiOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GridViewiOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 25 | 1C5870DE982E3356B44BE405 /* Pods_GridViewtvOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GridViewtvOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 26 | 1F805947CD4D71E9436CAAEA /* Pods_GridView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GridView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | 27A019588BF85702B9CAB206 /* Pods_GridView_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GridView_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | 2C058DF87FBE7E667A44ADE6 /* Pods-GridView-tvOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GridView-tvOS.release.xcconfig"; path = "../Pods/Target Support Files/Pods-GridView-tvOS/Pods-GridView-tvOS.release.xcconfig"; sourceTree = ""; }; 29 | 59AEDC9AC0D4A9128C9CD79C /* Pods-GridView-iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GridView-iOS.release.xcconfig"; path = "../Pods/Target Support Files/Pods-GridView-iOS/Pods-GridView-iOS.release.xcconfig"; sourceTree = ""; }; 30 | 720417ABDD1A73FBA94F2E9B /* Pods-GridView-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GridView-iOS.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-GridView-iOS/Pods-GridView-iOS.debug.xcconfig"; sourceTree = ""; }; 31 | 742A1FFCA4093103C2C53118 /* Pods-GridViewiOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GridViewiOS.release.xcconfig"; path = "../Pods/Target Support Files/Pods-GridViewiOS/Pods-GridViewiOS.release.xcconfig"; sourceTree = ""; }; 32 | 892FDE831EB214E000B1A333 /* GridView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GridView.h; sourceTree = ""; }; 33 | 892FDE841EB214E000B1A333 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | 892FDF441EB23E5700B1A333 /* GridView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GridView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | 892FDF521EB23F7E00B1A333 /* GridView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GridView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | 892FDF5B1EB38E3C00B1A333 /* GridLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GridLayout.swift; sourceTree = ""; }; 37 | 892FDF5E1EB38F8700B1A333 /* GridController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GridController.swift; sourceTree = ""; }; 38 | 89A764DB1F246EE0000F764C /* GridConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GridConfiguration.swift; sourceTree = ""; }; 39 | 89A764DE1F246F09000F764C /* Slot.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Slot.swift; sourceTree = ""; }; 40 | 89D4A7791EB6EA4E0006E05D /* GridView.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = GridView.podspec; path = ../GridView.podspec; sourceTree = ""; }; 41 | 9484A8A48975014F5D00AAF2 /* Pods-GridViewtvOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GridViewtvOS.release.xcconfig"; path = "../Pods/Target Support Files/Pods-GridViewtvOS/Pods-GridViewtvOS.release.xcconfig"; sourceTree = ""; }; 42 | 9C34590FB0748DC9CD597B1A /* Pods_GridView_tvOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GridView_tvOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | D767140C1638E089E440D122 /* Pods-GridViewtvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GridViewtvOS.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-GridViewtvOS/Pods-GridViewtvOS.debug.xcconfig"; sourceTree = ""; }; 44 | DA8A676670554168D076C4B3 /* Pods-GridView-tvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GridView-tvOS.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-GridView-tvOS/Pods-GridView-tvOS.debug.xcconfig"; sourceTree = ""; }; 45 | DCCE150DFD6A4B9653DF6C4A /* Pods-GridViewiOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GridViewiOS.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-GridViewiOS/Pods-GridViewiOS.debug.xcconfig"; sourceTree = ""; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | 892FDF401EB23E5700B1A333 /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | 400F8E3CD308C212BF3CAD06 /* Pods_GridViewiOS.framework in Frameworks */, 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | 892FDF4E1EB23F7E00B1A333 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | 7A432967B3BBF52F96902CE3 /* Pods_GridViewtvOS.framework in Frameworks */, 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | 056B319CB79333C420177D0F /* Pods */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 720417ABDD1A73FBA94F2E9B /* Pods-GridView-iOS.debug.xcconfig */, 72 | 59AEDC9AC0D4A9128C9CD79C /* Pods-GridView-iOS.release.xcconfig */, 73 | DA8A676670554168D076C4B3 /* Pods-GridView-tvOS.debug.xcconfig */, 74 | 2C058DF87FBE7E667A44ADE6 /* Pods-GridView-tvOS.release.xcconfig */, 75 | DCCE150DFD6A4B9653DF6C4A /* Pods-GridViewiOS.debug.xcconfig */, 76 | 742A1FFCA4093103C2C53118 /* Pods-GridViewiOS.release.xcconfig */, 77 | D767140C1638E089E440D122 /* Pods-GridViewtvOS.debug.xcconfig */, 78 | 9484A8A48975014F5D00AAF2 /* Pods-GridViewtvOS.release.xcconfig */, 79 | ); 80 | name = Pods; 81 | sourceTree = ""; 82 | }; 83 | 892FDE761EB214E000B1A333 = { 84 | isa = PBXGroup; 85 | children = ( 86 | 89D4A7791EB6EA4E0006E05D /* GridView.podspec */, 87 | 892FDE821EB214E000B1A333 /* GridView */, 88 | 892FDE811EB214E000B1A333 /* Products */, 89 | 056B319CB79333C420177D0F /* Pods */, 90 | AE7C45FDE1DC7A9FAC657D47 /* Frameworks */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | 892FDE811EB214E000B1A333 /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 892FDF441EB23E5700B1A333 /* GridView.framework */, 98 | 892FDF521EB23F7E00B1A333 /* GridView.framework */, 99 | ); 100 | name = Products; 101 | sourceTree = ""; 102 | }; 103 | 892FDE821EB214E000B1A333 /* GridView */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 892FDE831EB214E000B1A333 /* GridView.h */, 107 | 892FDE841EB214E000B1A333 /* Info.plist */, 108 | 892FDF5E1EB38F8700B1A333 /* GridController.swift */, 109 | 89A764DB1F246EE0000F764C /* GridConfiguration.swift */, 110 | 89A764DE1F246F09000F764C /* Slot.swift */, 111 | 892FDF5B1EB38E3C00B1A333 /* GridLayout.swift */, 112 | ); 113 | path = GridView; 114 | sourceTree = ""; 115 | }; 116 | AE7C45FDE1DC7A9FAC657D47 /* Frameworks */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 1F805947CD4D71E9436CAAEA /* Pods_GridView.framework */, 120 | 27A019588BF85702B9CAB206 /* Pods_GridView_iOS.framework */, 121 | 9C34590FB0748DC9CD597B1A /* Pods_GridView_tvOS.framework */, 122 | 1BEF5A4FDDFB73F179A38AD8 /* Pods_GridViewiOS.framework */, 123 | 1C5870DE982E3356B44BE405 /* Pods_GridViewtvOS.framework */, 124 | ); 125 | name = Frameworks; 126 | sourceTree = ""; 127 | }; 128 | /* End PBXGroup section */ 129 | 130 | /* Begin PBXHeadersBuildPhase section */ 131 | 892FDF411EB23E5700B1A333 /* Headers */ = { 132 | isa = PBXHeadersBuildPhase; 133 | buildActionMask = 2147483647; 134 | files = ( 135 | ); 136 | runOnlyForDeploymentPostprocessing = 0; 137 | }; 138 | 892FDF4F1EB23F7E00B1A333 /* Headers */ = { 139 | isa = PBXHeadersBuildPhase; 140 | buildActionMask = 2147483647; 141 | files = ( 142 | ); 143 | runOnlyForDeploymentPostprocessing = 0; 144 | }; 145 | /* End PBXHeadersBuildPhase section */ 146 | 147 | /* Begin PBXNativeTarget section */ 148 | 892FDF431EB23E5700B1A333 /* GridViewiOS */ = { 149 | isa = PBXNativeTarget; 150 | buildConfigurationList = 892FDF491EB23E5700B1A333 /* Build configuration list for PBXNativeTarget "GridViewiOS" */; 151 | buildPhases = ( 152 | 5BE8CC34AE3FB5CB27E86BCA /* [CP] Check Pods Manifest.lock */, 153 | 892FDF3F1EB23E5700B1A333 /* Sources */, 154 | 892FDF401EB23E5700B1A333 /* Frameworks */, 155 | 892FDF411EB23E5700B1A333 /* Headers */, 156 | 892FDF421EB23E5700B1A333 /* Resources */, 157 | F4CC992E3400EA0C5C01F6F2 /* [CP] Copy Pods Resources */, 158 | ); 159 | buildRules = ( 160 | ); 161 | dependencies = ( 162 | ); 163 | name = GridViewiOS; 164 | productName = GridViewiOS; 165 | productReference = 892FDF441EB23E5700B1A333 /* GridView.framework */; 166 | productType = "com.apple.product-type.framework"; 167 | }; 168 | 892FDF511EB23F7E00B1A333 /* GridViewtvOS */ = { 169 | isa = PBXNativeTarget; 170 | buildConfigurationList = 892FDF571EB23F7E00B1A333 /* Build configuration list for PBXNativeTarget "GridViewtvOS" */; 171 | buildPhases = ( 172 | 7F27AE9296B265923E9D0C37 /* [CP] Check Pods Manifest.lock */, 173 | 892FDF4D1EB23F7E00B1A333 /* Sources */, 174 | 892FDF4E1EB23F7E00B1A333 /* Frameworks */, 175 | 892FDF4F1EB23F7E00B1A333 /* Headers */, 176 | 892FDF501EB23F7E00B1A333 /* Resources */, 177 | 4D40B30D332A792531D0EFCF /* [CP] Copy Pods Resources */, 178 | ); 179 | buildRules = ( 180 | ); 181 | dependencies = ( 182 | ); 183 | name = GridViewtvOS; 184 | productName = GridViewtvOS; 185 | productReference = 892FDF521EB23F7E00B1A333 /* GridView.framework */; 186 | productType = "com.apple.product-type.framework"; 187 | }; 188 | /* End PBXNativeTarget section */ 189 | 190 | /* Begin PBXProject section */ 191 | 892FDE771EB214E000B1A333 /* Project object */ = { 192 | isa = PBXProject; 193 | attributes = { 194 | LastUpgradeCheck = 0830; 195 | ORGANIZATIONNAME = "Bruno Macabeus Aquino"; 196 | TargetAttributes = { 197 | 892FDF431EB23E5700B1A333 = { 198 | CreatedOnToolsVersion = 8.3; 199 | DevelopmentTeam = 56KUK57QCP; 200 | ProvisioningStyle = Automatic; 201 | }; 202 | 892FDF511EB23F7E00B1A333 = { 203 | CreatedOnToolsVersion = 8.3; 204 | DevelopmentTeam = 56KUK57QCP; 205 | ProvisioningStyle = Automatic; 206 | }; 207 | }; 208 | }; 209 | buildConfigurationList = 892FDE7A1EB214E000B1A333 /* Build configuration list for PBXProject "GridView" */; 210 | compatibilityVersion = "Xcode 3.2"; 211 | developmentRegion = English; 212 | hasScannedForEncodings = 0; 213 | knownRegions = ( 214 | en, 215 | ); 216 | mainGroup = 892FDE761EB214E000B1A333; 217 | productRefGroup = 892FDE811EB214E000B1A333 /* Products */; 218 | projectDirPath = ""; 219 | projectRoot = ""; 220 | targets = ( 221 | 892FDF431EB23E5700B1A333 /* GridViewiOS */, 222 | 892FDF511EB23F7E00B1A333 /* GridViewtvOS */, 223 | ); 224 | }; 225 | /* End PBXProject section */ 226 | 227 | /* Begin PBXResourcesBuildPhase section */ 228 | 892FDF421EB23E5700B1A333 /* Resources */ = { 229 | isa = PBXResourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | 89D4A77A1EB6EA4E0006E05D /* GridView.podspec in Resources */, 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | 892FDF501EB23F7E00B1A333 /* Resources */ = { 237 | isa = PBXResourcesBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | }; 243 | /* End PBXResourcesBuildPhase section */ 244 | 245 | /* Begin PBXShellScriptBuildPhase section */ 246 | 4D40B30D332A792531D0EFCF /* [CP] Copy Pods Resources */ = { 247 | isa = PBXShellScriptBuildPhase; 248 | buildActionMask = 2147483647; 249 | files = ( 250 | ); 251 | inputPaths = ( 252 | ); 253 | name = "[CP] Copy Pods Resources"; 254 | outputPaths = ( 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | shellPath = /bin/sh; 258 | shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-GridViewtvOS/Pods-GridViewtvOS-resources.sh\"\n"; 259 | showEnvVarsInLog = 0; 260 | }; 261 | 5BE8CC34AE3FB5CB27E86BCA /* [CP] Check Pods Manifest.lock */ = { 262 | isa = PBXShellScriptBuildPhase; 263 | buildActionMask = 2147483647; 264 | files = ( 265 | ); 266 | inputPaths = ( 267 | ); 268 | name = "[CP] Check Pods Manifest.lock"; 269 | outputPaths = ( 270 | ); 271 | runOnlyForDeploymentPostprocessing = 0; 272 | shellPath = /bin/sh; 273 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; 274 | showEnvVarsInLog = 0; 275 | }; 276 | 7F27AE9296B265923E9D0C37 /* [CP] Check Pods Manifest.lock */ = { 277 | isa = PBXShellScriptBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | ); 281 | inputPaths = ( 282 | ); 283 | name = "[CP] Check Pods Manifest.lock"; 284 | outputPaths = ( 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | shellPath = /bin/sh; 288 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; 289 | showEnvVarsInLog = 0; 290 | }; 291 | F4CC992E3400EA0C5C01F6F2 /* [CP] Copy Pods Resources */ = { 292 | isa = PBXShellScriptBuildPhase; 293 | buildActionMask = 2147483647; 294 | files = ( 295 | ); 296 | inputPaths = ( 297 | ); 298 | name = "[CP] Copy Pods Resources"; 299 | outputPaths = ( 300 | ); 301 | runOnlyForDeploymentPostprocessing = 0; 302 | shellPath = /bin/sh; 303 | shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-GridViewiOS/Pods-GridViewiOS-resources.sh\"\n"; 304 | showEnvVarsInLog = 0; 305 | }; 306 | /* End PBXShellScriptBuildPhase section */ 307 | 308 | /* Begin PBXSourcesBuildPhase section */ 309 | 892FDF3F1EB23E5700B1A333 /* Sources */ = { 310 | isa = PBXSourcesBuildPhase; 311 | buildActionMask = 2147483647; 312 | files = ( 313 | 89A764DC1F246EE0000F764C /* GridConfiguration.swift in Sources */, 314 | 892FDF5F1EB38F8700B1A333 /* GridController.swift in Sources */, 315 | 892FDF5C1EB38E3C00B1A333 /* GridLayout.swift in Sources */, 316 | 89A764DF1F246F09000F764C /* Slot.swift in Sources */, 317 | ); 318 | runOnlyForDeploymentPostprocessing = 0; 319 | }; 320 | 892FDF4D1EB23F7E00B1A333 /* Sources */ = { 321 | isa = PBXSourcesBuildPhase; 322 | buildActionMask = 2147483647; 323 | files = ( 324 | 89A764DD1F246EF6000F764C /* GridConfiguration.swift in Sources */, 325 | 892FDF601EB38F9300B1A333 /* GridController.swift in Sources */, 326 | 892FDF5D1EB38E9100B1A333 /* GridLayout.swift in Sources */, 327 | 89A764E01F246F0E000F764C /* Slot.swift in Sources */, 328 | ); 329 | runOnlyForDeploymentPostprocessing = 0; 330 | }; 331 | /* End PBXSourcesBuildPhase section */ 332 | 333 | /* Begin XCBuildConfiguration section */ 334 | 892FDE861EB214E000B1A333 /* Debug */ = { 335 | isa = XCBuildConfiguration; 336 | buildSettings = { 337 | ALWAYS_SEARCH_USER_PATHS = NO; 338 | CLANG_ANALYZER_NONNULL = YES; 339 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 340 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 341 | CLANG_CXX_LIBRARY = "libc++"; 342 | CLANG_ENABLE_MODULES = YES; 343 | CLANG_ENABLE_OBJC_ARC = YES; 344 | CLANG_WARN_BOOL_CONVERSION = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 348 | CLANG_WARN_EMPTY_BODY = YES; 349 | CLANG_WARN_ENUM_CONVERSION = YES; 350 | CLANG_WARN_INFINITE_RECURSION = YES; 351 | CLANG_WARN_INT_CONVERSION = YES; 352 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 353 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 354 | CLANG_WARN_UNREACHABLE_CODE = YES; 355 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 356 | COPY_PHASE_STRIP = NO; 357 | CURRENT_PROJECT_VERSION = 1; 358 | DEBUG_INFORMATION_FORMAT = dwarf; 359 | ENABLE_STRICT_OBJC_MSGSEND = YES; 360 | ENABLE_TESTABILITY = YES; 361 | GCC_C_LANGUAGE_STANDARD = gnu99; 362 | GCC_DYNAMIC_NO_PIC = NO; 363 | GCC_NO_COMMON_BLOCKS = YES; 364 | GCC_OPTIMIZATION_LEVEL = 0; 365 | GCC_PREPROCESSOR_DEFINITIONS = ( 366 | "DEBUG=1", 367 | "$(inherited)", 368 | ); 369 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 370 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 371 | GCC_WARN_UNDECLARED_SELECTOR = YES; 372 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 373 | GCC_WARN_UNUSED_FUNCTION = YES; 374 | GCC_WARN_UNUSED_VARIABLE = YES; 375 | MTL_ENABLE_DEBUG_INFO = YES; 376 | ONLY_ACTIVE_ARCH = YES; 377 | SDKROOT = appletvos; 378 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 379 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 380 | TARGETED_DEVICE_FAMILY = 3; 381 | TVOS_DEPLOYMENT_TARGET = 10.2; 382 | VERSIONING_SYSTEM = "apple-generic"; 383 | VERSION_INFO_PREFIX = ""; 384 | }; 385 | name = Debug; 386 | }; 387 | 892FDE871EB214E000B1A333 /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | buildSettings = { 390 | ALWAYS_SEARCH_USER_PATHS = NO; 391 | CLANG_ANALYZER_NONNULL = YES; 392 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 393 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 394 | CLANG_CXX_LIBRARY = "libc++"; 395 | CLANG_ENABLE_MODULES = YES; 396 | CLANG_ENABLE_OBJC_ARC = YES; 397 | CLANG_WARN_BOOL_CONVERSION = YES; 398 | CLANG_WARN_CONSTANT_CONVERSION = YES; 399 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 400 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 401 | CLANG_WARN_EMPTY_BODY = YES; 402 | CLANG_WARN_ENUM_CONVERSION = YES; 403 | CLANG_WARN_INFINITE_RECURSION = YES; 404 | CLANG_WARN_INT_CONVERSION = YES; 405 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 406 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 407 | CLANG_WARN_UNREACHABLE_CODE = YES; 408 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 409 | COPY_PHASE_STRIP = NO; 410 | CURRENT_PROJECT_VERSION = 1; 411 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 412 | ENABLE_NS_ASSERTIONS = NO; 413 | ENABLE_STRICT_OBJC_MSGSEND = YES; 414 | GCC_C_LANGUAGE_STANDARD = gnu99; 415 | GCC_NO_COMMON_BLOCKS = YES; 416 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 417 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 418 | GCC_WARN_UNDECLARED_SELECTOR = YES; 419 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 420 | GCC_WARN_UNUSED_FUNCTION = YES; 421 | GCC_WARN_UNUSED_VARIABLE = YES; 422 | MTL_ENABLE_DEBUG_INFO = NO; 423 | SDKROOT = appletvos; 424 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 425 | TARGETED_DEVICE_FAMILY = 3; 426 | TVOS_DEPLOYMENT_TARGET = 10.2; 427 | VALIDATE_PRODUCT = YES; 428 | VERSIONING_SYSTEM = "apple-generic"; 429 | VERSION_INFO_PREFIX = ""; 430 | }; 431 | name = Release; 432 | }; 433 | 892FDF4A1EB23E5700B1A333 /* Debug */ = { 434 | isa = XCBuildConfiguration; 435 | baseConfigurationReference = DCCE150DFD6A4B9653DF6C4A /* Pods-GridViewiOS.debug.xcconfig */; 436 | buildSettings = { 437 | CODE_SIGN_IDENTITY = ""; 438 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 439 | DEFINES_MODULE = YES; 440 | DEVELOPMENT_TEAM = 56KUK57QCP; 441 | DYLIB_COMPATIBILITY_VERSION = 1; 442 | DYLIB_CURRENT_VERSION = 1; 443 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 444 | INFOPLIST_FILE = GridView/Info.plist; 445 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 446 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 447 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 448 | PRODUCT_BUNDLE_IDENTIFIER = macabeus.GridView; 449 | PRODUCT_NAME = GridView; 450 | SDKROOT = iphoneos; 451 | SKIP_INSTALL = YES; 452 | SWIFT_VERSION = 3.0; 453 | TARGETED_DEVICE_FAMILY = "1,2"; 454 | }; 455 | name = Debug; 456 | }; 457 | 892FDF4B1EB23E5700B1A333 /* Release */ = { 458 | isa = XCBuildConfiguration; 459 | baseConfigurationReference = 742A1FFCA4093103C2C53118 /* Pods-GridViewiOS.release.xcconfig */; 460 | buildSettings = { 461 | CODE_SIGN_IDENTITY = ""; 462 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 463 | DEFINES_MODULE = YES; 464 | DEVELOPMENT_TEAM = 56KUK57QCP; 465 | DYLIB_COMPATIBILITY_VERSION = 1; 466 | DYLIB_CURRENT_VERSION = 1; 467 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 468 | INFOPLIST_FILE = GridView/Info.plist; 469 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 470 | IPHONEOS_DEPLOYMENT_TARGET = 10.3; 471 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 472 | PRODUCT_BUNDLE_IDENTIFIER = macabeus.GridView; 473 | PRODUCT_NAME = GridView; 474 | SDKROOT = iphoneos; 475 | SKIP_INSTALL = YES; 476 | SWIFT_VERSION = 3.0; 477 | TARGETED_DEVICE_FAMILY = "1,2"; 478 | }; 479 | name = Release; 480 | }; 481 | 892FDF581EB23F7E00B1A333 /* Debug */ = { 482 | isa = XCBuildConfiguration; 483 | baseConfigurationReference = D767140C1638E089E440D122 /* Pods-GridViewtvOS.debug.xcconfig */; 484 | buildSettings = { 485 | CODE_SIGN_IDENTITY = ""; 486 | DEFINES_MODULE = YES; 487 | DEVELOPMENT_TEAM = 56KUK57QCP; 488 | DYLIB_COMPATIBILITY_VERSION = 1; 489 | DYLIB_CURRENT_VERSION = 1; 490 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 491 | INFOPLIST_FILE = GridView/Info.plist; 492 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 493 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 494 | PRODUCT_BUNDLE_IDENTIFIER = macabeus.GridViewtvOS; 495 | PRODUCT_NAME = GridView; 496 | SKIP_INSTALL = YES; 497 | SWIFT_VERSION = 3.0; 498 | }; 499 | name = Debug; 500 | }; 501 | 892FDF591EB23F7E00B1A333 /* Release */ = { 502 | isa = XCBuildConfiguration; 503 | baseConfigurationReference = 9484A8A48975014F5D00AAF2 /* Pods-GridViewtvOS.release.xcconfig */; 504 | buildSettings = { 505 | CODE_SIGN_IDENTITY = ""; 506 | DEFINES_MODULE = YES; 507 | DEVELOPMENT_TEAM = 56KUK57QCP; 508 | DYLIB_COMPATIBILITY_VERSION = 1; 509 | DYLIB_CURRENT_VERSION = 1; 510 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 511 | INFOPLIST_FILE = GridView/Info.plist; 512 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 513 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 514 | PRODUCT_BUNDLE_IDENTIFIER = macabeus.GridViewtvOS; 515 | PRODUCT_NAME = GridView; 516 | SKIP_INSTALL = YES; 517 | SWIFT_VERSION = 3.0; 518 | }; 519 | name = Release; 520 | }; 521 | /* End XCBuildConfiguration section */ 522 | 523 | /* Begin XCConfigurationList section */ 524 | 892FDE7A1EB214E000B1A333 /* Build configuration list for PBXProject "GridView" */ = { 525 | isa = XCConfigurationList; 526 | buildConfigurations = ( 527 | 892FDE861EB214E000B1A333 /* Debug */, 528 | 892FDE871EB214E000B1A333 /* Release */, 529 | ); 530 | defaultConfigurationIsVisible = 0; 531 | defaultConfigurationName = Release; 532 | }; 533 | 892FDF491EB23E5700B1A333 /* Build configuration list for PBXNativeTarget "GridViewiOS" */ = { 534 | isa = XCConfigurationList; 535 | buildConfigurations = ( 536 | 892FDF4A1EB23E5700B1A333 /* Debug */, 537 | 892FDF4B1EB23E5700B1A333 /* Release */, 538 | ); 539 | defaultConfigurationIsVisible = 0; 540 | defaultConfigurationName = Release; 541 | }; 542 | 892FDF571EB23F7E00B1A333 /* Build configuration list for PBXNativeTarget "GridViewtvOS" */ = { 543 | isa = XCConfigurationList; 544 | buildConfigurations = ( 545 | 892FDF581EB23F7E00B1A333 /* Debug */, 546 | 892FDF591EB23F7E00B1A333 /* Release */, 547 | ); 548 | defaultConfigurationIsVisible = 0; 549 | defaultConfigurationName = Release; 550 | }; 551 | /* End XCConfigurationList section */ 552 | }; 553 | rootObject = 892FDE771EB214E000B1A333 /* Project object */; 554 | } 555 | -------------------------------------------------------------------------------- /GridView/GridView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /GridView/GridView/GridConfiguration.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GridConfiguration.swift 3 | // GridView 4 | // 5 | // Created by Bruno Macabeus Aquino on 23/07/17. 6 | // Copyright © 2017 Bruno Macabeus Aquino. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public class GridConfiguration { 12 | 13 | public let slots: Slots 14 | public let parseSlotStep: [ParseSlotStep] 15 | public let gridNumberOfRows: Int 16 | public let gridNumberOfColumns: Int 17 | let indexPathToRowColumn: [IndexPath: (row: CountableClosedRange, column: CountableClosedRange)] 18 | private let cellPerRow: [Int: [IndexPath]] 19 | private let cellPerColumn: [Int: [IndexPath]] 20 | 21 | private init(slots: Slots, parseSlotStep: [ParseSlotStep], gridNumberOfRows: Int, gridNumberOfColumns: Int, indexPathToRowColumn: [IndexPath: (row: CountableClosedRange, column: CountableClosedRange)], cellPerRow: [Int: [IndexPath]], cellPerColumn: [Int: [IndexPath]]) { 22 | 23 | self.slots = slots 24 | self.parseSlotStep = parseSlotStep 25 | self.gridNumberOfRows = gridNumberOfRows 26 | self.gridNumberOfColumns = gridNumberOfColumns 27 | self.indexPathToRowColumn = indexPathToRowColumn 28 | self.cellPerRow = cellPerRow 29 | self.cellPerColumn = cellPerColumn 30 | } 31 | 32 | public class func create(slots: Slots) -> GridConfiguration { 33 | 34 | //// 35 | // parse 36 | var results: [ParseSlotStep] = [] 37 | var cellPerRow: [Int: [IndexPath]] = [:] 38 | var cellPerColumn: [Int: [IndexPath]] = [:] 39 | var indexPathToRowColumn: [IndexPath: (row: CountableClosedRange, column: CountableClosedRange)] = [:] 40 | 41 | let slotsFilleds = MatrixBool(initialWidth: 1, initialHeight: 1) 42 | 43 | // fill the collection view 44 | var indexPathSection = -1 45 | var indexPathItem = 0 46 | 47 | var column: Int 48 | var columnsFill: Int 49 | 50 | for section in 0.. 0 { 59 | // get the first column with free space 60 | while slotsFilleds.matrix[section][columnsFill] { 61 | columnsFill += 1 62 | } 63 | column = columnsFill 64 | } else { 65 | // if the row don't have a cell 66 | columnsFill = slotsFilleds.matrix[0].count 67 | } 68 | 69 | // 70 | for item in 0.. Set { 159 | return Set(cellPerColumn[column] ?? []) 160 | } 161 | 162 | func getCellOf(row: Int) -> Set { 163 | return Set(cellPerRow[row] ?? []) 164 | } 165 | } 166 | 167 | fileprivate class MatrixBool { 168 | var matrix: [[Bool]] 169 | 170 | init(initialWidth: Int, initialHeight: Int) { 171 | 172 | let values = [Bool](repeating: false, count: initialWidth) 173 | matrix = [] 174 | 175 | for _ in 0.. [SlotableCell.Type] 46 | 47 | /** 48 | This delegate is called in *collectionView(_:cellForItemAt)* from *GridViewController*. 49 | It's useful when we need to setup many cells with same code 50 | */ 51 | func setup(cell: SlotableCell) 52 | } 53 | 54 | public class GridViewController: UICollectionViewController, GridLayoutDelegate { 55 | 56 | public var gridConfiguration = GridConfiguration.create(slots: Slots(slots: [[]])) 57 | public var delegate: GridViewDelegate? 58 | 59 | override public func viewDidLoad() { 60 | super.viewDidLoad() 61 | 62 | collectionView!.collectionViewLayout = GridLayout() 63 | (collectionView!.collectionViewLayout as! GridLayout).delegate = self 64 | 65 | // Register cells 66 | let cells = delegate!.getCellToRegister() 67 | 68 | cells.forEach { 69 | let className = getClassName(of: $0)! 70 | let nib = UINib(nibName: className, bundle: Bundle(for: $0 as! AnyClass)) 71 | 72 | collectionView!.register(nib, forCellWithReuseIdentifier: className) 73 | } 74 | 75 | // Set background color clear, for default 76 | self.view.backgroundColor = UIColor.clear 77 | } 78 | 79 | var gridLayout: GridLayout { 80 | return (collectionView!.collectionViewLayout as! GridLayout) 81 | } 82 | 83 | /** 84 | If you changed the *gridConfiguration* and want reload the grid, use this method. 85 | **NEVER** use *reloadData()* 86 | */ 87 | public func reloadGrid() { 88 | (collectionView!.collectionViewLayout as! GridLayout).clearCache() 89 | collectionView!.reloadData() 90 | } 91 | 92 | override public func numberOfSections(in collectionView: UICollectionView) -> Int { 93 | return gridConfiguration.slots.numberOfSections() 94 | } 95 | 96 | override public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 97 | return gridConfiguration.slots.numberOfItemsAt(section: section) 98 | } 99 | 100 | override public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 101 | 102 | let slot = gridConfiguration.slots.slotAt(section: indexPath.section, item: indexPath.item) 103 | var cell = collectionView.dequeueReusableCell(withReuseIdentifier: getClassName(of: slot.cell)!, for: indexPath) as! SlotableCell 104 | 105 | // start cell 106 | cell.slotParams = slot.params 107 | cell.load() 108 | delegate!.setup(cell: cell) 109 | 110 | // for some reason, in some cases, the collectionview reuse the previus cell frame, and, we don't want this behavior; we want use the frame setted by GridLayout 111 | (cell as! UICollectionViewCell).frame = gridLayout.cache.first(where: { $0.indexPath == indexPath })!.frame 112 | 113 | // 114 | return cell as! UICollectionViewCell 115 | } 116 | 117 | // 118 | func getClassName(of any: Any) -> String? { 119 | return "\(any)".components(separatedBy: ".").last 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /GridView/GridView/GridLayout.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GridLayout.swift 3 | // GridView 4 | // 5 | // Created by Bruno Macabeus Aquino on 28/04/17. 6 | // Copyright © 2017 Bruno Macabeus Aquino. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | protocol GridLayoutDelegate { 12 | 13 | var gridConfiguration: GridConfiguration { get } 14 | } 15 | 16 | public class GridLayout: UICollectionViewLayout { 17 | 18 | var delegate: GridLayoutDelegate! 19 | 20 | var cellPadding: CGFloat = 6.0 21 | 22 | var cache = [UICollectionViewLayoutAttributes]() 23 | 24 | private var contentHeight: CGFloat = 0.0 25 | private var contentWidth: CGFloat { 26 | let insets = collectionView!.contentInset 27 | return collectionView!.bounds.width - (insets.left + insets.right) 28 | } 29 | 30 | public var numberOfColumns: Int { 31 | return delegate.gridConfiguration.gridNumberOfColumns 32 | } 33 | 34 | public var numberOfRows: Int { 35 | return delegate.gridConfiguration.gridNumberOfRows 36 | } 37 | 38 | public var columnWidth: CGFloat { 39 | return contentWidth / CGFloat(numberOfColumns) 40 | } 41 | 42 | public var columnRow: CGFloat { 43 | return (collectionView!.bounds.height / CGFloat(numberOfRows)) - cellPadding * CGFloat(numberOfRows) 44 | } 45 | 46 | override public func prepare() { 47 | 48 | if cache.isEmpty { 49 | // initialize variables with the dimensions 50 | var xOffset = [CGFloat]() 51 | for column in 0.. 1 { // se a célula ocupa mais que um slot horizontal, acrescentar à célula o espaço de padding 76 | height += CGFloat(slotHeight) * cellPadding 77 | } 78 | 79 | // desenhar o frame da célula e adicioná-la ao cache 80 | let frame = CGRect(x: xOffset[column], y: yOffset[column], width: cellWidth, height: height) 81 | let insetFrame = frame.insetBy(dx: cellPadding, dy: cellPadding) 82 | 83 | let indexPath = IndexPath(item: indexPathSection, section: indexPathItem) 84 | let attributes = UICollectionViewLayoutAttributes(forCellWith: indexPath) 85 | attributes.frame = insetFrame 86 | cache.append(attributes) 87 | 88 | // 89 | for i in 0.. [UICollectionViewLayoutAttributes]? { 111 | var layoutAttributes = [UICollectionViewLayoutAttributes]() 112 | 113 | for attributes in cache { 114 | if attributes.frame.intersects(rect) { 115 | layoutAttributes.append(attributes) 116 | } 117 | } 118 | return layoutAttributes 119 | } 120 | 121 | func clearCache() { 122 | self.cache = [] 123 | } 124 | 125 | } 126 | -------------------------------------------------------------------------------- /GridView/GridView/GridView.h: -------------------------------------------------------------------------------- 1 | // 2 | // GridView.h 3 | // GridView 4 | // 5 | // Created by Bruno Macabeus Aquino on 27/04/17. 6 | // Copyright © 2017 Bruno Macabeus Aquino. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for GridView. 12 | FOUNDATION_EXPORT double GridViewVersionNumber; 13 | 14 | //! Project version string for GridView. 15 | FOUNDATION_EXPORT const unsigned char GridViewVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /GridView/GridView/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 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /GridView/GridView/Slot.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Slot.swift 3 | // GridView 4 | // 5 | // Created by Bruno Macabeus Aquino on 23/07/17. 6 | // Copyright © 2017 Bruno Macabeus Aquino. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /** 12 | Struct to encapsulate the cell with yours parameters, to show in grid. 13 | The parameters are passed to *setup(cell:params)* and *load(params)* methods 14 | */ 15 | public struct Slot { 16 | public let cell: SlotableCell.Type 17 | public let params: [String: Any] 18 | 19 | public init(cell: SlotableCell.Type, params: [String: Any]) { 20 | self.cell = cell 21 | self.params = params 22 | } 23 | } 24 | 25 | public class Slots { 26 | 27 | private let slots: [[Slot]] 28 | 29 | public init(slots: [[Slot]]) { 30 | self.slots = slots 31 | } 32 | 33 | func numberOfSections() -> Int { 34 | return slots.count 35 | } 36 | 37 | func numberOfItemsAt(section: Int) -> Int { 38 | return slots[section].count 39 | } 40 | 41 | func slotAt(section: Int, item: Int) -> Slot { 42 | return slots[section][item] 43 | } 44 | 45 | /** 46 | Return the size of a cell 47 | */ 48 | func slotSizeAt(section: Int, item: Int) -> (width: Int, height: Int) { 49 | let slot = slots[section][item].cell 50 | 51 | return (slot.slotWidth, slot.slotHeight) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | copyright 2016 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included 12 | in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | workspace './GridView.xcworkspace' 2 | 3 | target 'GridViewtvOS' do 4 | project 'GridView/GridView.xcodeproj' 5 | platform :tvos 6 | 7 | use_frameworks! 8 | 9 | # Pods for GridViewtvOS 10 | 11 | end 12 | 13 | target 'GridViewiOS' do 14 | project 'GridView/GridView.xcodeproj' 15 | platform :ios 16 | 17 | use_frameworks! 18 | 19 | # Pods for GridViewiOS 20 | 21 | end 22 | 23 | target 'Example-tvOS' do 24 | project 'Example-tvOS/Example-tvOS.xcodeproj' 25 | platform :tvos, "10.2" 26 | 27 | use_frameworks! 28 | 29 | # Pods for Example-tvOS 30 | pod 'GridView', :path => '.' 31 | end 32 | 33 | target 'Example-iOS' do 34 | project 'Example-iOS/Example-iOS.xcodeproj' 35 | platform :ios, "10.3" 36 | 37 | use_frameworks! 38 | 39 | # Pods for Example-iOS 40 | pod 'GridView', :path => '.' 41 | end 42 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - GridView (0.1.2) 3 | 4 | DEPENDENCIES: 5 | - GridView (from `.`) 6 | 7 | EXTERNAL SOURCES: 8 | GridView: 9 | :path: . 10 | 11 | SPEC CHECKSUMS: 12 | GridView: 61b3bd505c142cfc13843bd4209e4a7edca52f0a 13 | 14 | PODFILE CHECKSUM: 9a5303cdd141945f46a098a4fcefca5c8e762d94 15 | 16 | COCOAPODS: 1.2.1 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Version](https://img.shields.io/cocoapods/v/GridView.svg?style=flat)](http://cocoapods.org/pods/GridView) 2 | [![License](https://img.shields.io/cocoapods/l/GridView.svg?style=flat)](http://cocoapods.org/pods/GridView) 3 | [![Platform](https://img.shields.io/cocoapods/p/GridView.svg?style=flat)](http://cocoapods.org/pods/GridView) 4 | 5 | # GridView 6 | 📜 Amazing grid view in your tvOS/iOS app 7 | 8 | ![](http://i.imgur.com/Zn3c7bD.png) 9 | ![](http://i.imgur.com/0fccFX3.png) 10 | 11 | You can download this repository and see this example app. 12 | 13 | # How to use 14 | 15 | ## Install 16 | In `Podfile` add 17 | ``` 18 | pod 'GridView' 19 | ``` 20 | 21 | and use `pod install`. 22 | 23 | ## Setup 24 | 25 | ### Storyboard 26 | ![](http://i.imgur.com/nNbAekE.png) 27 | 28 | 1. Create a *Container View* 29 | 2. Change the *View Controller* for *Collection View Controller* 30 | 3. Set `GridViewController` as a custom class 31 | 32 | ### Create a cell 33 | 34 | To display a cell in grid, the cell need be a `UICollectionViewCell` and subscriber the protocol `SlotableCell`.
35 | And, you need create a xib file with *Collection View Cell*. The xib, and cell's indentifier in xib file, **need** have the same name of the class. 36 | 37 | Minimal example: 38 | 39 | ```swift 40 | import UIKit 41 | import GridView 42 | 43 | class CellLogs: UICollectionViewCell, SlotableCell { 44 | 45 | static let slotWidth = 1 // size of cell in grid 📏 46 | static let slotHeight = 1 // size of cell in grid 📐 47 | var slotParams: [String : Any] = [:] 48 | 49 | func load() { 50 | // this method if called when a cell is created in grid 🔨 51 | } 52 | } 53 | ``` 54 | 55 | When the grid will show the `CellLogs`, will get the `CellLogs.xib` and run the `load(params)` method. 56 | 57 | ### Code 58 | 59 | Your controller that will manager a grid need subscriber the protocol `GridViewDelegate` 60 | 61 | Minimal example: 62 | 63 | ```swift 64 | extension ViewController: GridViewDelegate { 65 | func getCellToRegister() -> [SlotableCell.Type] { 66 | // we need register cell's class, then, send it's where 🖋 67 | 68 | return [CellLogs.self, CellMap.self] 69 | 70 | // if do you want list all classes that subscreber the SlotableCell protocol, you can read use this gist: https://gist.github.com/brunomacabeusbr/eea343bb9119b96eed3393e41dcda0c9 💜 71 | } 72 | 73 | func setup(cell: SlotableCell) { 74 | // this delegate is called in "collectionView(_:cellForItemAt)" from GridViewController 75 | // it's useful when we need to setup many cells with same code 🍡 76 | 77 | // for example, connect to server, if a cell need 78 | if let cellRealTime = cell as? CellRealTimeProtocol { 79 | cellRealTime.connect() 80 | } 81 | 82 | // layout 83 | (cell as? UICollectionViewCell)?.layer.cornerRadius = 10 84 | } 85 | } 86 | ``` 87 | 88 | Then, we need set a variable to manager a grid and set `ViewController` as a delegate. 89 | 90 | Minimal example: 91 | 92 | ```swift 93 | class ViewController: UIViewController { 94 | 95 | @IBOutlet weak var container: UIView! 96 | var containerGrid: GridViewController? 97 | 98 | override func viewDidLoad() { 99 | super.viewDidLoad() 100 | 101 | // set the cells to show in grid 📌 102 | containerGrid!.gridConfiguration = GridConfiguration.create(slots: Slots(slots: [ 103 | [Slot(cell: CellMap.self, params: [:]), Slot(cell: CellChart.self, params: [:])], 104 | [Slot(cell: CellLogs.self, params: [:])], 105 | [Slot(cell: CellCharacter.self, params: ["race": "troll"]), Slot(cell: CellCharacter.self, params: ["race": "elves"]), Slot(cell: CellCharacter.self, params: ["race": "undead"]), Slot(cell: CellCharacter.self, params: ["race": "merfolk"])] 106 | ]) 107 | ) 108 | } 109 | 110 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 111 | 112 | if segue.identifier == "segueGrid" { 113 | self.containerGrid = (segue.destination as! GridViewController) 114 | self.containerGrid!.delegate = self 115 | } 116 | } 117 | } 118 | ``` 119 | 120 | To understand how to set layout with `gridConfiguration` correctly, read the section "How GridView work?". 121 | 122 | ### params 123 | 124 | When you create a `Slot`, you set a cell of this slot, and also **params** of this slot. For example: 125 | 126 | ```swift 127 | Slot(cell: CellCharacter.self, params: ["race": "undead"]) 128 | ``` 129 | 130 | The value of `params` is set in attribute `slotParams` of `SlotableCell`. 131 | 132 | Example of use: 133 | 134 | ```swift 135 | class CellCharacter: UICollectionViewCell, SlotableCell { 136 | 137 | ... 138 | var slotParams: [String : Any] = [:] 139 | 140 | func load() { 141 | let paramRace = slotParams["race"] as? String 142 | 143 | switch paramRace { 144 | case "undead"?: 145 | image.image = UIImage(named: "undead")! 146 | case "elves"?: 147 | image.image = UIImage(named: "elves")! 148 | case "troll"?: 149 | image.image = UIImage(named: "troll")! 150 | default: 151 | print("invalid race: \(paramRace ?? "nil")") 152 | } 153 | } 154 | } 155 | ``` 156 | 157 | ### How to reload a grid? 158 | 159 | If you already a set a value to `gridConfiguration`, and want set a new value, to reload a grid use the method `reloadGrid()`. 160 | 161 | ```swift 162 | containerGrid!.gridConfiguration = [ ... ] // new values for my awesome grid 163 | containerGrid!.reloadGrid() // reload it 164 | ``` 165 | 166 | # How GridView work? 167 | 168 | The GridView **always** show all cells, and set in each cell a proportional size with the `slotWidth` and `slotHeight`. 169 | 170 | ![](http://i.imgur.com/Z6G8ymq.png) 171 | 172 | When GridView will draw a cell, check if have a enough space in first slot. If have, draw. If haven't, check in the second slot, and so on.
173 | The total of columns is calculated at runtime. 174 | 175 | --- 176 | 177 | **Maintainer**: 178 | 179 | > [macabeus](http://macalogs.com.br/)  ·  180 | > GitHub [@macabeus](https://github.com/macabeus) 181 | --------------------------------------------------------------------------------