├── CollectionViewInsideTableViewExample.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── johncodeos.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── johncodeos.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ └── xcschememanagement.plist ├── CollectionViewInsideTableViewExample ├── .DS_Store ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── 1024.png │ │ ├── 120.png │ │ ├── 152.png │ │ ├── 167.png │ │ ├── 180.png │ │ ├── 20.png │ │ ├── 29.png │ │ ├── 40.png │ │ ├── 58.png │ │ ├── 60.png │ │ ├── 76.png │ │ ├── 80.png │ │ ├── 87.png │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Colors.swift ├── DetailsViewController.swift ├── Info.plist ├── Supporting Files │ ├── AppDelegate.swift │ ├── Extensions.swift │ └── SceneDelegate.swift ├── TableView.swift └── TableViewCell │ ├── CollectionViewCell │ ├── CollectionViewCell.swift │ ├── CollectionViewCell.xib │ └── CollectionViewCellModel.swift │ ├── TableViewCell.swift │ ├── TableViewCell.xib │ └── TableViewCellModel.swift └── README.md /CollectionViewInsideTableViewExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C21458D323AEABA400B74A5D /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = C21458D223AEABA400B74A5D /* Colors.swift */; }; 11 | C21458D523AEABAF00B74A5D /* CollectionViewCellModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C21458D423AEABAF00B74A5D /* CollectionViewCellModel.swift */; }; 12 | C21458D723AEAD0800B74A5D /* TableViewCellModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C21458D623AEAD0800B74A5D /* TableViewCellModel.swift */; }; 13 | C21458DA23AEBCFC00B74A5D /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C21458D923AEBCFC00B74A5D /* Extensions.swift */; }; 14 | C21DC2B523AD2AC800171DDC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C21DC2B423AD2AC800171DDC /* AppDelegate.swift */; }; 15 | C21DC2B723AD2AC800171DDC /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C21DC2B623AD2AC800171DDC /* SceneDelegate.swift */; }; 16 | C21DC2B923AD2AC800171DDC /* TableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C21DC2B823AD2AC800171DDC /* TableView.swift */; }; 17 | C21DC2BC23AD2AC800171DDC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C21DC2BA23AD2AC800171DDC /* Main.storyboard */; }; 18 | C21DC2BE23AD2AC900171DDC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C21DC2BD23AD2AC900171DDC /* Assets.xcassets */; }; 19 | C21DC2C123AD2AC900171DDC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C21DC2BF23AD2AC900171DDC /* LaunchScreen.storyboard */; }; 20 | C22808C223BA5E8500E649F6 /* DetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C22808C123BA5E8500E649F6 /* DetailsViewController.swift */; }; 21 | C25FCA4A23AE6A9C00F6863F /* CollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C25FCA4823AE6A9C00F6863F /* CollectionViewCell.swift */; }; 22 | C25FCA4B23AE6A9C00F6863F /* CollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C25FCA4923AE6A9C00F6863F /* CollectionViewCell.xib */; }; 23 | C2D32E4323AD7356002B5822 /* TableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2D32E4123AD7356002B5822 /* TableViewCell.swift */; }; 24 | C2D32E4423AD7356002B5822 /* TableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C2D32E4223AD7356002B5822 /* TableViewCell.xib */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXFileReference section */ 28 | C21458D223AEABA400B74A5D /* Colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Colors.swift; sourceTree = ""; }; 29 | C21458D423AEABAF00B74A5D /* CollectionViewCellModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewCellModel.swift; sourceTree = ""; }; 30 | C21458D623AEAD0800B74A5D /* TableViewCellModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewCellModel.swift; sourceTree = ""; }; 31 | C21458D923AEBCFC00B74A5D /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; 32 | C21DC2B123AD2AC800171DDC /* CollectionViewInsideTableViewExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CollectionViewInsideTableViewExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | C21DC2B423AD2AC800171DDC /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 34 | C21DC2B623AD2AC800171DDC /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 35 | C21DC2B823AD2AC800171DDC /* TableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableView.swift; sourceTree = ""; }; 36 | C21DC2BB23AD2AC800171DDC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 37 | C21DC2BD23AD2AC900171DDC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 38 | C21DC2C023AD2AC900171DDC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 39 | C21DC2C223AD2AC900171DDC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | C22808C123BA5E8500E649F6 /* DetailsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailsViewController.swift; sourceTree = ""; }; 41 | C25FCA4823AE6A9C00F6863F /* CollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewCell.swift; sourceTree = ""; }; 42 | C25FCA4923AE6A9C00F6863F /* CollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CollectionViewCell.xib; sourceTree = ""; }; 43 | C2D32E4123AD7356002B5822 /* TableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewCell.swift; sourceTree = ""; }; 44 | C2D32E4223AD7356002B5822 /* TableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TableViewCell.xib; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | C21DC2AE23AD2AC800171DDC /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | C21458D823AEBCED00B74A5D /* Supporting Files */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | C21DC2B423AD2AC800171DDC /* AppDelegate.swift */, 62 | C21DC2B623AD2AC800171DDC /* SceneDelegate.swift */, 63 | C21458D923AEBCFC00B74A5D /* Extensions.swift */, 64 | ); 65 | path = "Supporting Files"; 66 | sourceTree = ""; 67 | }; 68 | C21DC2A823AD2AC800171DDC = { 69 | isa = PBXGroup; 70 | children = ( 71 | C21DC2B323AD2AC800171DDC /* CollectionViewInsideTableViewExample */, 72 | C21DC2B223AD2AC800171DDC /* Products */, 73 | ); 74 | sourceTree = ""; 75 | }; 76 | C21DC2B223AD2AC800171DDC /* Products */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | C21DC2B123AD2AC800171DDC /* CollectionViewInsideTableViewExample.app */, 80 | ); 81 | name = Products; 82 | sourceTree = ""; 83 | }; 84 | C21DC2B323AD2AC800171DDC /* CollectionViewInsideTableViewExample */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | C21458D823AEBCED00B74A5D /* Supporting Files */, 88 | C25B2C2023B15A73003DE467 /* TableViewCell */, 89 | C21DC2B823AD2AC800171DDC /* TableView.swift */, 90 | C21DC2BA23AD2AC800171DDC /* Main.storyboard */, 91 | C21DC2BD23AD2AC900171DDC /* Assets.xcassets */, 92 | C21DC2BF23AD2AC900171DDC /* LaunchScreen.storyboard */, 93 | C21DC2C223AD2AC900171DDC /* Info.plist */, 94 | C21458D223AEABA400B74A5D /* Colors.swift */, 95 | C22808C123BA5E8500E649F6 /* DetailsViewController.swift */, 96 | ); 97 | path = CollectionViewInsideTableViewExample; 98 | sourceTree = ""; 99 | }; 100 | C25B2C2023B15A73003DE467 /* TableViewCell */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | C2D32E4123AD7356002B5822 /* TableViewCell.swift */, 104 | C2D32E4223AD7356002B5822 /* TableViewCell.xib */, 105 | C21458D623AEAD0800B74A5D /* TableViewCellModel.swift */, 106 | C25B2C2123B15A88003DE467 /* CollectionViewCell */, 107 | ); 108 | path = TableViewCell; 109 | sourceTree = ""; 110 | }; 111 | C25B2C2123B15A88003DE467 /* CollectionViewCell */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | C25FCA4823AE6A9C00F6863F /* CollectionViewCell.swift */, 115 | C25FCA4923AE6A9C00F6863F /* CollectionViewCell.xib */, 116 | C21458D423AEABAF00B74A5D /* CollectionViewCellModel.swift */, 117 | ); 118 | path = CollectionViewCell; 119 | sourceTree = ""; 120 | }; 121 | /* End PBXGroup section */ 122 | 123 | /* Begin PBXNativeTarget section */ 124 | C21DC2B023AD2AC800171DDC /* CollectionViewInsideTableViewExample */ = { 125 | isa = PBXNativeTarget; 126 | buildConfigurationList = C21DC2C523AD2AC900171DDC /* Build configuration list for PBXNativeTarget "CollectionViewInsideTableViewExample" */; 127 | buildPhases = ( 128 | C21DC2AD23AD2AC800171DDC /* Sources */, 129 | C21DC2AE23AD2AC800171DDC /* Frameworks */, 130 | C21DC2AF23AD2AC800171DDC /* Resources */, 131 | ); 132 | buildRules = ( 133 | ); 134 | dependencies = ( 135 | ); 136 | name = CollectionViewInsideTableViewExample; 137 | productName = CollectionViewInsideTableViewExample; 138 | productReference = C21DC2B123AD2AC800171DDC /* CollectionViewInsideTableViewExample.app */; 139 | productType = "com.apple.product-type.application"; 140 | }; 141 | /* End PBXNativeTarget section */ 142 | 143 | /* Begin PBXProject section */ 144 | C21DC2A923AD2AC800171DDC /* Project object */ = { 145 | isa = PBXProject; 146 | attributes = { 147 | LastSwiftUpdateCheck = 1130; 148 | LastUpgradeCheck = 1130; 149 | ORGANIZATIONNAME = "John Codeos"; 150 | TargetAttributes = { 151 | C21DC2B023AD2AC800171DDC = { 152 | CreatedOnToolsVersion = 11.3; 153 | }; 154 | }; 155 | }; 156 | buildConfigurationList = C21DC2AC23AD2AC800171DDC /* Build configuration list for PBXProject "CollectionViewInsideTableViewExample" */; 157 | compatibilityVersion = "Xcode 9.3"; 158 | developmentRegion = en; 159 | hasScannedForEncodings = 0; 160 | knownRegions = ( 161 | en, 162 | Base, 163 | ); 164 | mainGroup = C21DC2A823AD2AC800171DDC; 165 | productRefGroup = C21DC2B223AD2AC800171DDC /* Products */; 166 | projectDirPath = ""; 167 | projectRoot = ""; 168 | targets = ( 169 | C21DC2B023AD2AC800171DDC /* CollectionViewInsideTableViewExample */, 170 | ); 171 | }; 172 | /* End PBXProject section */ 173 | 174 | /* Begin PBXResourcesBuildPhase section */ 175 | C21DC2AF23AD2AC800171DDC /* Resources */ = { 176 | isa = PBXResourcesBuildPhase; 177 | buildActionMask = 2147483647; 178 | files = ( 179 | C21DC2C123AD2AC900171DDC /* LaunchScreen.storyboard in Resources */, 180 | C2D32E4423AD7356002B5822 /* TableViewCell.xib in Resources */, 181 | C21DC2BE23AD2AC900171DDC /* Assets.xcassets in Resources */, 182 | C21DC2BC23AD2AC800171DDC /* Main.storyboard in Resources */, 183 | C25FCA4B23AE6A9C00F6863F /* CollectionViewCell.xib in Resources */, 184 | ); 185 | runOnlyForDeploymentPostprocessing = 0; 186 | }; 187 | /* End PBXResourcesBuildPhase section */ 188 | 189 | /* Begin PBXSourcesBuildPhase section */ 190 | C21DC2AD23AD2AC800171DDC /* Sources */ = { 191 | isa = PBXSourcesBuildPhase; 192 | buildActionMask = 2147483647; 193 | files = ( 194 | C25FCA4A23AE6A9C00F6863F /* CollectionViewCell.swift in Sources */, 195 | C21458DA23AEBCFC00B74A5D /* Extensions.swift in Sources */, 196 | C21458D523AEABAF00B74A5D /* CollectionViewCellModel.swift in Sources */, 197 | C21458D323AEABA400B74A5D /* Colors.swift in Sources */, 198 | C21DC2B923AD2AC800171DDC /* TableView.swift in Sources */, 199 | C2D32E4323AD7356002B5822 /* TableViewCell.swift in Sources */, 200 | C21DC2B523AD2AC800171DDC /* AppDelegate.swift in Sources */, 201 | C21DC2B723AD2AC800171DDC /* SceneDelegate.swift in Sources */, 202 | C21458D723AEAD0800B74A5D /* TableViewCellModel.swift in Sources */, 203 | C22808C223BA5E8500E649F6 /* DetailsViewController.swift in Sources */, 204 | ); 205 | runOnlyForDeploymentPostprocessing = 0; 206 | }; 207 | /* End PBXSourcesBuildPhase section */ 208 | 209 | /* Begin PBXVariantGroup section */ 210 | C21DC2BA23AD2AC800171DDC /* Main.storyboard */ = { 211 | isa = PBXVariantGroup; 212 | children = ( 213 | C21DC2BB23AD2AC800171DDC /* Base */, 214 | ); 215 | name = Main.storyboard; 216 | sourceTree = ""; 217 | }; 218 | C21DC2BF23AD2AC900171DDC /* LaunchScreen.storyboard */ = { 219 | isa = PBXVariantGroup; 220 | children = ( 221 | C21DC2C023AD2AC900171DDC /* Base */, 222 | ); 223 | name = LaunchScreen.storyboard; 224 | sourceTree = ""; 225 | }; 226 | /* End PBXVariantGroup section */ 227 | 228 | /* Begin XCBuildConfiguration section */ 229 | C21DC2C323AD2AC900171DDC /* Debug */ = { 230 | isa = XCBuildConfiguration; 231 | buildSettings = { 232 | ALWAYS_SEARCH_USER_PATHS = NO; 233 | CLANG_ANALYZER_NONNULL = YES; 234 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 235 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 236 | CLANG_CXX_LIBRARY = "libc++"; 237 | CLANG_ENABLE_MODULES = YES; 238 | CLANG_ENABLE_OBJC_ARC = YES; 239 | CLANG_ENABLE_OBJC_WEAK = YES; 240 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 241 | CLANG_WARN_BOOL_CONVERSION = YES; 242 | CLANG_WARN_COMMA = YES; 243 | CLANG_WARN_CONSTANT_CONVERSION = YES; 244 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 245 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 246 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 247 | CLANG_WARN_EMPTY_BODY = YES; 248 | CLANG_WARN_ENUM_CONVERSION = YES; 249 | CLANG_WARN_INFINITE_RECURSION = YES; 250 | CLANG_WARN_INT_CONVERSION = YES; 251 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 252 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 253 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 255 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 256 | CLANG_WARN_STRICT_PROTOTYPES = YES; 257 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 258 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 259 | CLANG_WARN_UNREACHABLE_CODE = YES; 260 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 261 | COPY_PHASE_STRIP = NO; 262 | DEBUG_INFORMATION_FORMAT = dwarf; 263 | ENABLE_STRICT_OBJC_MSGSEND = YES; 264 | ENABLE_TESTABILITY = YES; 265 | GCC_C_LANGUAGE_STANDARD = gnu11; 266 | GCC_DYNAMIC_NO_PIC = NO; 267 | GCC_NO_COMMON_BLOCKS = YES; 268 | GCC_OPTIMIZATION_LEVEL = 0; 269 | GCC_PREPROCESSOR_DEFINITIONS = ( 270 | "DEBUG=1", 271 | "$(inherited)", 272 | ); 273 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 274 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 275 | GCC_WARN_UNDECLARED_SELECTOR = YES; 276 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 277 | GCC_WARN_UNUSED_FUNCTION = YES; 278 | GCC_WARN_UNUSED_VARIABLE = YES; 279 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 280 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 281 | MTL_FAST_MATH = YES; 282 | ONLY_ACTIVE_ARCH = YES; 283 | SDKROOT = iphoneos; 284 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 285 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 286 | }; 287 | name = Debug; 288 | }; 289 | C21DC2C423AD2AC900171DDC /* Release */ = { 290 | isa = XCBuildConfiguration; 291 | buildSettings = { 292 | ALWAYS_SEARCH_USER_PATHS = NO; 293 | CLANG_ANALYZER_NONNULL = YES; 294 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 295 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 296 | CLANG_CXX_LIBRARY = "libc++"; 297 | CLANG_ENABLE_MODULES = YES; 298 | CLANG_ENABLE_OBJC_ARC = YES; 299 | CLANG_ENABLE_OBJC_WEAK = YES; 300 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 301 | CLANG_WARN_BOOL_CONVERSION = YES; 302 | CLANG_WARN_COMMA = YES; 303 | CLANG_WARN_CONSTANT_CONVERSION = YES; 304 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 305 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 306 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 307 | CLANG_WARN_EMPTY_BODY = YES; 308 | CLANG_WARN_ENUM_CONVERSION = YES; 309 | CLANG_WARN_INFINITE_RECURSION = YES; 310 | CLANG_WARN_INT_CONVERSION = YES; 311 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 312 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 313 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 314 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 315 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 316 | CLANG_WARN_STRICT_PROTOTYPES = YES; 317 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 318 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 319 | CLANG_WARN_UNREACHABLE_CODE = YES; 320 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 321 | COPY_PHASE_STRIP = NO; 322 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 323 | ENABLE_NS_ASSERTIONS = NO; 324 | ENABLE_STRICT_OBJC_MSGSEND = YES; 325 | GCC_C_LANGUAGE_STANDARD = gnu11; 326 | GCC_NO_COMMON_BLOCKS = YES; 327 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 328 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 329 | GCC_WARN_UNDECLARED_SELECTOR = YES; 330 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 331 | GCC_WARN_UNUSED_FUNCTION = YES; 332 | GCC_WARN_UNUSED_VARIABLE = YES; 333 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 334 | MTL_ENABLE_DEBUG_INFO = NO; 335 | MTL_FAST_MATH = YES; 336 | SDKROOT = iphoneos; 337 | SWIFT_COMPILATION_MODE = wholemodule; 338 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 339 | VALIDATE_PRODUCT = YES; 340 | }; 341 | name = Release; 342 | }; 343 | C21DC2C623AD2AC900171DDC /* Debug */ = { 344 | isa = XCBuildConfiguration; 345 | buildSettings = { 346 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 347 | CODE_SIGN_STYLE = Automatic; 348 | DEVELOPMENT_TEAM = 6P8Q9Q6J62; 349 | INFOPLIST_FILE = CollectionViewInsideTableViewExample/Info.plist; 350 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 351 | LD_RUNPATH_SEARCH_PATHS = ( 352 | "$(inherited)", 353 | "@executable_path/Frameworks", 354 | ); 355 | PRODUCT_BUNDLE_IDENTIFIER = com.example.CollectionViewInsideTableViewExample; 356 | PRODUCT_NAME = "$(TARGET_NAME)"; 357 | SWIFT_VERSION = 5.0; 358 | TARGETED_DEVICE_FAMILY = "1,2"; 359 | }; 360 | name = Debug; 361 | }; 362 | C21DC2C723AD2AC900171DDC /* Release */ = { 363 | isa = XCBuildConfiguration; 364 | buildSettings = { 365 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 366 | CODE_SIGN_STYLE = Automatic; 367 | DEVELOPMENT_TEAM = 6P8Q9Q6J62; 368 | INFOPLIST_FILE = CollectionViewInsideTableViewExample/Info.plist; 369 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 370 | LD_RUNPATH_SEARCH_PATHS = ( 371 | "$(inherited)", 372 | "@executable_path/Frameworks", 373 | ); 374 | PRODUCT_BUNDLE_IDENTIFIER = com.example.CollectionViewInsideTableViewExample; 375 | PRODUCT_NAME = "$(TARGET_NAME)"; 376 | SWIFT_VERSION = 5.0; 377 | TARGETED_DEVICE_FAMILY = "1,2"; 378 | }; 379 | name = Release; 380 | }; 381 | /* End XCBuildConfiguration section */ 382 | 383 | /* Begin XCConfigurationList section */ 384 | C21DC2AC23AD2AC800171DDC /* Build configuration list for PBXProject "CollectionViewInsideTableViewExample" */ = { 385 | isa = XCConfigurationList; 386 | buildConfigurations = ( 387 | C21DC2C323AD2AC900171DDC /* Debug */, 388 | C21DC2C423AD2AC900171DDC /* Release */, 389 | ); 390 | defaultConfigurationIsVisible = 0; 391 | defaultConfigurationName = Release; 392 | }; 393 | C21DC2C523AD2AC900171DDC /* Build configuration list for PBXNativeTarget "CollectionViewInsideTableViewExample" */ = { 394 | isa = XCConfigurationList; 395 | buildConfigurations = ( 396 | C21DC2C623AD2AC900171DDC /* Debug */, 397 | C21DC2C723AD2AC900171DDC /* Release */, 398 | ); 399 | defaultConfigurationIsVisible = 0; 400 | defaultConfigurationName = Release; 401 | }; 402 | /* End XCConfigurationList section */ 403 | }; 404 | rootObject = C21DC2A923AD2AC800171DDC /* Project object */; 405 | } 406 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample.xcodeproj/project.xcworkspace/xcuserdata/johncodeos.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncodeos-blog/CollectionViewInsideTableViewExample/3ad724e769385b50e77b5688ec14ef3e2d064579/CollectionViewInsideTableViewExample.xcodeproj/project.xcworkspace/xcuserdata/johncodeos.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample.xcodeproj/xcuserdata/johncodeos.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample.xcodeproj/xcuserdata/johncodeos.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CollectionViewInsideTableViewExample.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncodeos-blog/CollectionViewInsideTableViewExample/3ad724e769385b50e77b5688ec14ef3e2d064579/CollectionViewInsideTableViewExample/.DS_Store -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncodeos-blog/CollectionViewInsideTableViewExample/3ad724e769385b50e77b5688ec14ef3e2d064579/CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/1024.png -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncodeos-blog/CollectionViewInsideTableViewExample/3ad724e769385b50e77b5688ec14ef3e2d064579/CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/120.png -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncodeos-blog/CollectionViewInsideTableViewExample/3ad724e769385b50e77b5688ec14ef3e2d064579/CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/152.png -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncodeos-blog/CollectionViewInsideTableViewExample/3ad724e769385b50e77b5688ec14ef3e2d064579/CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/167.png -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncodeos-blog/CollectionViewInsideTableViewExample/3ad724e769385b50e77b5688ec14ef3e2d064579/CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/180.png -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncodeos-blog/CollectionViewInsideTableViewExample/3ad724e769385b50e77b5688ec14ef3e2d064579/CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/20.png -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncodeos-blog/CollectionViewInsideTableViewExample/3ad724e769385b50e77b5688ec14ef3e2d064579/CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/29.png -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncodeos-blog/CollectionViewInsideTableViewExample/3ad724e769385b50e77b5688ec14ef3e2d064579/CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/40.png -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncodeos-blog/CollectionViewInsideTableViewExample/3ad724e769385b50e77b5688ec14ef3e2d064579/CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/58.png -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncodeos-blog/CollectionViewInsideTableViewExample/3ad724e769385b50e77b5688ec14ef3e2d064579/CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/60.png -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncodeos-blog/CollectionViewInsideTableViewExample/3ad724e769385b50e77b5688ec14ef3e2d064579/CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/76.png -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncodeos-blog/CollectionViewInsideTableViewExample/3ad724e769385b50e77b5688ec14ef3e2d064579/CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/80.png -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johncodeos-blog/CollectionViewInsideTableViewExample/3ad724e769385b50e77b5688ec14ef3e2d064579/CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/87.png -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "40.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "60.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "58.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "87.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "80.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "120.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "120.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "180.png", 49 | "scale" : "3x" 50 | }, 51 | { 52 | "size" : "20x20", 53 | "idiom" : "ipad", 54 | "filename" : "20.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "40.png", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "size" : "29x29", 65 | "idiom" : "ipad", 66 | "filename" : "29.png", 67 | "scale" : "1x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "58.png", 73 | "scale" : "2x" 74 | }, 75 | { 76 | "size" : "40x40", 77 | "idiom" : "ipad", 78 | "filename" : "40.png", 79 | "scale" : "1x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "80.png", 85 | "scale" : "2x" 86 | }, 87 | { 88 | "size" : "76x76", 89 | "idiom" : "ipad", 90 | "filename" : "76.png", 91 | "scale" : "1x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "152.png", 97 | "scale" : "2x" 98 | }, 99 | { 100 | "size" : "83.5x83.5", 101 | "idiom" : "ipad", 102 | "filename" : "167.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "1024x1024", 107 | "idiom" : "ios-marketing", 108 | "filename" : "1024.png", 109 | "scale" : "1x" 110 | } 111 | ], 112 | "info" : { 113 | "version" : 1, 114 | "author" : "xcode" 115 | } 116 | } -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/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 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 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 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Colors.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Colors.swift 3 | // CollectionViewInsideTableViewExample 4 | // 5 | // Created by John Codeos on 12/21/19. 6 | // Copyright © 2019 John Codeos. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | struct Colors { 13 | var objectsArray = [ 14 | TableViewCellModel( 15 | category: "Category #1", 16 | subcategory: ["SubCategory #1.1", "SubCategory #1.2"], 17 | colors: [ 18 | // SubCategory #1.1 19 | [CollectionViewCellModel(color: UIColor.colorFromHex("#DA70D6"), name: "Orchid"), 20 | CollectionViewCellModel(color: UIColor.colorFromHex("#FA8072"), name: "Salmon"), 21 | CollectionViewCellModel(color: UIColor.colorFromHex("#FDF5E6"), name: "Old Lace"), 22 | CollectionViewCellModel(color: UIColor.colorFromHex("#00FFFF"), name: "Aqua"), 23 | CollectionViewCellModel(color: UIColor.colorFromHex("#2E8B57"), name: "Sea Green")], 24 | // SubCategory #1.2 25 | [CollectionViewCellModel(color: UIColor.colorFromHex("#2F4F4F"), name: "Dark Slate Gray"), 26 | CollectionViewCellModel(color: UIColor.colorFromHex("#F0FFF0"), name: "Honeydew"), 27 | CollectionViewCellModel(color: UIColor.colorFromHex("#DCDCDC"), name: "Gainsboro")] 28 | ]), 29 | TableViewCellModel( 30 | category: "Category #2", 31 | subcategory: ["SubCategory #2.1"], 32 | colors: [ 33 | // SubCategory #2.1 34 | [CollectionViewCellModel(color: UIColor.colorFromHex("#FFE4B5"), name: "Moccasin"), 35 | CollectionViewCellModel(color: UIColor.colorFromHex("#AFEEEE"), name: "Pale Turquoise"), 36 | CollectionViewCellModel(color: UIColor.colorFromHex("#9400D3"), name: "Dark Violet"), 37 | CollectionViewCellModel(color: UIColor.colorFromHex("#3CB371"), name: "Medium Sea Green")] 38 | ]), 39 | TableViewCellModel( 40 | category: "Category #3", 41 | subcategory: ["SubCategory #3.1", "SubCategory #3.2"], 42 | colors: [ 43 | // SubCategory #3.1 44 | [CollectionViewCellModel(color: UIColor.colorFromHex("#FF6347"), name: "Tomato"), 45 | CollectionViewCellModel(color: UIColor.colorFromHex("#4682B4"), name: "Steel Blue"), 46 | CollectionViewCellModel(color: UIColor.colorFromHex("#778899"), name: "Light Slate Gray"), 47 | CollectionViewCellModel(color: UIColor.colorFromHex("#191970"), name: "Midnight Blue"), 48 | CollectionViewCellModel(color: UIColor.colorFromHex("#A52A2A"), name: "Brown")], 49 | // SubCategory #3.2 50 | [CollectionViewCellModel(color: UIColor.colorFromHex("#FFF8DC"), name: "Cornsilk"), 51 | CollectionViewCellModel(color: UIColor.colorFromHex("#FF00FF"), name: "Magenta"), 52 | CollectionViewCellModel(color: UIColor.colorFromHex("#7CFC00"), name: "Lawn Green"), 53 | CollectionViewCellModel(color: UIColor.colorFromHex("#000000"), name: "Black"), 54 | CollectionViewCellModel(color: UIColor.colorFromHex("#00BFFF"), name: "Deep Sky Blue"), 55 | CollectionViewCellModel(color: UIColor.colorFromHex("#6495ED"), name: "Cornflower Blue"), 56 | CollectionViewCellModel(color: UIColor.colorFromHex("#FF8C00"), name: "Dark Orange"), 57 | CollectionViewCellModel(color: UIColor.colorFromHex("#20B2AA"), name: "Light Sea Green"), 58 | CollectionViewCellModel(color: UIColor.colorFromHex("#FFC0CB"), name: "Pink")] 59 | ]), 60 | TableViewCellModel( 61 | category: "Category #4", 62 | subcategory: ["SubCategory #4.1", "SubCategory #4.2"], 63 | colors: [ 64 | // SubCategory #4.1 65 | [CollectionViewCellModel(color: UIColor.colorFromHex("#DDA0DD"), name: "Plum"), 66 | CollectionViewCellModel(color: UIColor.colorFromHex("#FFF5EE"), name: "Seashell"), 67 | CollectionViewCellModel(color: UIColor.colorFromHex("#FFDEAD"), name: "Navajo White"), 68 | CollectionViewCellModel(color: UIColor.colorFromHex("#00FF00"), name: "Lime"), 69 | CollectionViewCellModel(color: UIColor.colorFromHex("#F0E68C"), name: "Khaki")], 70 | // SubCategory #4.2 71 | [CollectionViewCellModel(color: UIColor.colorFromHex("#FAEBD7"), name: "Antique White"), 72 | CollectionViewCellModel(color: UIColor.colorFromHex("#C71585"), name: "Medium Violet Red"), 73 | CollectionViewCellModel(color: UIColor.colorFromHex("#6B8E23"), name: "Olive Drab"), 74 | CollectionViewCellModel(color: UIColor.colorFromHex("#FF4500"), name: "Orange Red"), 75 | CollectionViewCellModel(color: UIColor.colorFromHex("#FFF0F5"), name: "Lavender Blush")] 76 | ]), 77 | TableViewCellModel( 78 | category: "Category #5", 79 | subcategory: ["SubCategory #5.1", "SubCategory #5.2"], 80 | colors: [ 81 | // SubCategory #5.1 82 | [CollectionViewCellModel(color: UIColor.colorFromHex("#9966CC"), name: "Amethyst")], 83 | // SubCategory #5.2 84 | [CollectionViewCellModel(color: UIColor.colorFromHex("#7B68EE"), name: "Medium Slate Blue"), 85 | CollectionViewCellModel(color: UIColor.colorFromHex("#800000"), name: "Maroon"), 86 | CollectionViewCellModel(color: UIColor.colorFromHex("#FFA07A"), name: "Light Salmon"), 87 | CollectionViewCellModel(color: UIColor.colorFromHex("#E6E6FA"), name: "Lavender"), 88 | CollectionViewCellModel(color: UIColor.colorFromHex("#FFE4C4"), name: "Bisque")] 89 | ]) 90 | ] 91 | } 92 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/DetailsViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DetailsViewController.swift 3 | // CollectionViewInsideTableViewExample 4 | // 5 | // Created by John Codeos on 12/30/19. 6 | // Copyright © 2019 John Codeos. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | 13 | class DetailsViewController: UIViewController { 14 | 15 | var backgroundColor: UIColor! 16 | var backgroundColorName: String! 17 | 18 | override func viewDidLoad() { 19 | super.viewDidLoad() 20 | self.view.backgroundColor = backgroundColor 21 | self.navigationItem.title = backgroundColorName 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | UISceneStoryboardFile 37 | Main 38 | 39 | 40 | 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIMainStoryboardFile 45 | Main 46 | UIRequiredDeviceCapabilities 47 | 48 | armv7 49 | 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationPortrait 53 | UIInterfaceOrientationLandscapeLeft 54 | UIInterfaceOrientationLandscapeRight 55 | 56 | UISupportedInterfaceOrientations~ipad 57 | 58 | UIInterfaceOrientationPortrait 59 | UIInterfaceOrientationPortraitUpsideDown 60 | UIInterfaceOrientationLandscapeLeft 61 | UIInterfaceOrientationLandscapeRight 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Supporting Files/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CollectionViewInsideTableViewExample 4 | // 5 | // Created by John Codeos on 12/20/19. 6 | // Copyright © 2019 John Codeos. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 14 | // Override point for customization after application launch. 15 | return true 16 | } 17 | 18 | // MARK: UISceneSession Lifecycle 19 | 20 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 21 | // Called when a new scene session is being created. 22 | // Use this method to select a configuration to create the new scene with. 23 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 24 | } 25 | 26 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 27 | // Called when the user discards a scene session. 28 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 29 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Supporting Files/Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Extensions.swift 3 | // CollectionViewInsideTableViewExample 4 | // 5 | // Created by John Codeos on 12/21/19. 6 | // Copyright © 2019 John Codeos. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | extension UIColor { 13 | static func rgbColor(red: CGFloat, green: CGFloat, blue: CGFloat) -> UIColor { 14 | return UIColor(red: red / 255, green: green / 255, blue: blue / 255, alpha: 1.0) 15 | } 16 | 17 | static func colorFromHex(_ hex: String) -> UIColor { 18 | var hexString = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased() 19 | if hexString.hasPrefix("#") { 20 | hexString.remove(at: hexString.startIndex) 21 | } 22 | if hexString.count != 6 { 23 | return UIColor.magenta 24 | } 25 | 26 | var rgb: UInt64 = 0 27 | Scanner(string: hexString).scanHexInt64(&rgb) 28 | 29 | return UIColor(red: CGFloat((rgb & 0xFF0000) >> 16) / 255, 30 | green: CGFloat((rgb & 0x00FF00) >> 8) / 255, 31 | blue: CGFloat(rgb & 0x0000FF) / 255, 32 | alpha: 1.0) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/Supporting Files/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // CollectionViewInsideTableViewExample 4 | // 5 | // Created by John Codeos on 12/20/19. 6 | // Copyright © 2019 John Codeos. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 12 | var window: UIWindow? 13 | 14 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 15 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 16 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 17 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 18 | guard let _ = (scene as? UIWindowScene) else { return } 19 | } 20 | 21 | func sceneDidDisconnect(_ scene: UIScene) { 22 | // Called as the scene is being released by the system. 23 | // This occurs shortly after the scene enters the background, or when its session is discarded. 24 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 25 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 26 | } 27 | 28 | func sceneDidBecomeActive(_ scene: UIScene) { 29 | // Called when the scene has moved from an inactive state to an active state. 30 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 31 | } 32 | 33 | func sceneWillResignActive(_ scene: UIScene) { 34 | // Called when the scene will move from an active state to an inactive state. 35 | // This may occur due to temporary interruptions (ex. an incoming phone call). 36 | } 37 | 38 | func sceneWillEnterForeground(_ scene: UIScene) { 39 | // Called as the scene transitions from the background to the foreground. 40 | // Use this method to undo the changes made on entering the background. 41 | } 42 | 43 | func sceneDidEnterBackground(_ scene: UIScene) { 44 | // Called as the scene transitions from the foreground to the background. 45 | // Use this method to save data, release shared resources, and store enough scene-specific state information 46 | // to restore the scene back to its current state. 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/TableView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // CollectionViewInsideTableViewExample 4 | // 5 | // Created by John Codeos on 12/20/19. 6 | // Copyright © 2019 John Codeos. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class TableView: UIViewController { 12 | 13 | @IBOutlet var tableView: UITableView! 14 | 15 | var colorsArray = Colors() 16 | var tappedCell: CollectionViewCellModel! 17 | 18 | override func viewDidLoad() { 19 | super.viewDidLoad() 20 | tableView.backgroundColor = UIColor.colorFromHex("#9E1C40") 21 | tableView.separatorStyle = .none 22 | 23 | // Register the xib for tableview cell 24 | let cellNib = UINib(nibName: "TableViewCell", bundle: nil) 25 | self.tableView.register(cellNib, forCellReuseIdentifier: "tableviewcellid") 26 | } 27 | } 28 | 29 | extension TableView: UITableViewDelegate, UITableViewDataSource { 30 | 31 | func numberOfSections(in tableView: UITableView) -> Int { 32 | return colorsArray.objectsArray.count 33 | } 34 | 35 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 36 | return colorsArray.objectsArray[section].subcategory.count 37 | } 38 | 39 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 40 | return 200 41 | } 42 | 43 | // Category Title 44 | func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { 45 | let headerView = UIView() 46 | headerView.backgroundColor = UIColor.colorFromHex("#BC224B") 47 | let titleLabel = UILabel(frame: CGRect(x: 8, y: 0, width: 200, height: 44)) 48 | headerView.addSubview(titleLabel) 49 | titleLabel.textColor = UIColor.white 50 | titleLabel.font = UIFont.systemFont(ofSize: 20, weight: .bold) 51 | titleLabel.text = colorsArray.objectsArray[section].category 52 | return headerView 53 | } 54 | 55 | func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { 56 | return 44 57 | } 58 | 59 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 60 | if let cell = tableView.dequeueReusableCell(withIdentifier: "tableviewcellid", for: indexPath) as? TableViewCell { 61 | // Show SubCategory Title 62 | let subCategoryTitle = colorsArray.objectsArray[indexPath.section].subcategory 63 | cell.subCategoryLabel.text = subCategoryTitle[indexPath.row] 64 | 65 | // Pass the data to colletionview inside the tableviewcell 66 | let rowArray = colorsArray.objectsArray[indexPath.section].colors[indexPath.row] 67 | cell.updateCellWith(row: rowArray) 68 | 69 | // Set cell's delegate 70 | cell.cellDelegate = self 71 | 72 | cell.selectionStyle = .none 73 | return cell 74 | } 75 | return UITableViewCell() 76 | } 77 | 78 | 79 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 80 | if segue.identifier == "detailsviewcontrollerseg" { 81 | let DestViewController = segue.destination as! DetailsViewController 82 | DestViewController.backgroundColor = tappedCell.color 83 | DestViewController.backgroundColorName = tappedCell.name 84 | } 85 | } 86 | } 87 | 88 | extension TableView: CollectionViewCellDelegate { 89 | func collectionView(collectionviewcell: CollectionViewCell?, index: Int, didTappedInTableViewCell: TableViewCell) { 90 | if let colorsRow = didTappedInTableViewCell.rowWithColors { 91 | self.tappedCell = colorsRow[index] 92 | performSegue(withIdentifier: "detailsviewcontrollerseg", sender: self) 93 | // You can also do changes to the cell you tapped using the 'collectionviewcell' 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/TableViewCell/CollectionViewCell/CollectionViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewCell.swift 3 | // CollectionViewInsideTableViewExample 4 | // 5 | // Created by John Codeos on 12/21/19. 6 | // Copyright © 2019 John Codeos. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class CollectionViewCell: UICollectionViewCell { 12 | 13 | @IBOutlet var colorView: UIView! 14 | @IBOutlet var nameLabel: UILabel! 15 | 16 | override func awakeFromNib() { 17 | super.awakeFromNib() 18 | // Initialization code 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/TableViewCell/CollectionViewCell/CollectionViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/TableViewCell/CollectionViewCell/CollectionViewCellModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ColorModel.swift 3 | // CollectionViewInsideTableViewExample 4 | // 5 | // Created by John Codeos on 12/21/19. 6 | // Copyright © 2019 John Codeos. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | struct CollectionViewCellModel { 13 | var color: UIColor 14 | var name: String 15 | } 16 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/TableViewCell/TableViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewCell.swift 3 | // CollectionViewInsideTableViewExample 4 | // 5 | // Created by John Codeos on 12/20/19. 6 | // Copyright © 2019 John Codeos. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | protocol CollectionViewCellDelegate: class { 12 | func collectionView(collectionviewcell: CollectionViewCell?, index: Int, didTappedInTableViewCell: TableViewCell) 13 | // other delegate methods that you can define to perform action in viewcontroller 14 | } 15 | 16 | class TableViewCell: UITableViewCell { 17 | 18 | weak var cellDelegate: CollectionViewCellDelegate? 19 | 20 | var rowWithColors: [CollectionViewCellModel]? 21 | 22 | @IBOutlet var subCategoryLabel: UILabel! 23 | @IBOutlet var collectionView: UICollectionView! 24 | 25 | override func awakeFromNib() { 26 | super.awakeFromNib() 27 | backgroundColor = UIColor.clear 28 | self.subCategoryLabel.textColor = UIColor.white 29 | 30 | // TODO: need to setup collection view flow layout 31 | let flowLayout = UICollectionViewFlowLayout() 32 | flowLayout.scrollDirection = .horizontal 33 | flowLayout.itemSize = CGSize(width: 150, height: 180) 34 | flowLayout.minimumLineSpacing = 2.0 35 | flowLayout.minimumInteritemSpacing = 5.0 36 | self.collectionView.collectionViewLayout = flowLayout 37 | self.collectionView.showsHorizontalScrollIndicator = false 38 | 39 | // Comment if you set Datasource and delegate in .xib 40 | self.collectionView.dataSource = self 41 | self.collectionView.delegate = self 42 | 43 | // Register the xib for collection view cell 44 | let cellNib = UINib(nibName: "CollectionViewCell", bundle: nil) 45 | self.collectionView.register(cellNib, forCellWithReuseIdentifier: "collectionviewcellid") 46 | } 47 | } 48 | 49 | extension TableViewCell: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { 50 | 51 | // The data we passed from the TableView send them to the CollectionView Model 52 | func updateCellWith(row: [CollectionViewCellModel]) { 53 | self.rowWithColors = row 54 | self.collectionView.reloadData() 55 | } 56 | 57 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { 58 | let cell = collectionView.cellForItem(at: indexPath) as? CollectionViewCell 59 | print("I'm tapping the \(indexPath.item)") 60 | self.cellDelegate?.collectionView(collectionviewcell: cell, index: indexPath.item, didTappedInTableViewCell: self) 61 | } 62 | 63 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 64 | return self.rowWithColors?.count ?? 0 65 | } 66 | 67 | func numberOfSections(in collectionView: UICollectionView) -> Int { 68 | return 1 69 | } 70 | 71 | // Set the data for each cell (color and color name) 72 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 73 | if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "collectionviewcellid", for: indexPath) as? CollectionViewCell { 74 | cell.colorView.backgroundColor = self.rowWithColors?[indexPath.item].color ?? UIColor.black 75 | cell.nameLabel.text = self.rowWithColors?[indexPath.item].name ?? "" 76 | return cell 77 | } 78 | return UICollectionViewCell() 79 | } 80 | 81 | // Add spaces at the beginning and the end of the collection view 82 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { 83 | return UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 5) 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/TableViewCell/TableViewCell.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 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /CollectionViewInsideTableViewExample/TableViewCell/TableViewCellModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewCellModel.swift 3 | // CollectionViewInsideTableViewExample 4 | // 5 | // Created by John Codeos on 12/21/19. 6 | // Copyright © 2019 John Codeos. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct TableViewCellModel { 12 | var category: String 13 | var subcategory: [String] 14 | var colors: [[CollectionViewCellModel]] 15 | } 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![logo](https://i.imgur.com/Dv73hCk.png) 2 | # CollectionViewInsideTableViewExample 3 | Add UICollectionView inside UITableViewCell using Swift 4 | 5 | https://johncodeos.com/how-to-add-uicollectionview-inside-uitableviewcell-using-swift/ 6 | --------------------------------------------------------------------------------