├── .gitignore ├── LICENSE ├── NGSwiftUITableCellSizing.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── xcshareddata │ └── xcschemes │ │ └── NGSwiftUITableCellSizing.xcscheme └── xcuserdata │ └── noahgilmore.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── NGSwiftUITableCellSizing ├── AppDelegate.swift ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ └── LaunchScreen.storyboard ├── CellView.swift ├── HostingCell.swift ├── Info.plist ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json ├── SceneDelegate.swift └── TableViewController.swift └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | # CocoaPods 52 | # 53 | # We recommend against adding the Pods directory to your .gitignore. However 54 | # you should judge for yourself, the pros and cons are mentioned at: 55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 56 | # 57 | # Pods/ 58 | # 59 | # Add this line if you want to avoid checking in source code from the Xcode workspace 60 | # *.xcworkspace 61 | 62 | # Carthage 63 | # 64 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 65 | # Carthage/Checkouts 66 | 67 | Carthage/Build/ 68 | 69 | # Accio dependency management 70 | Dependencies/ 71 | .accio/ 72 | 73 | # fastlane 74 | # 75 | # It is recommended to not store the screenshots in the git repo. 76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 77 | # For more information about the recommended setup visit: 78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 79 | 80 | fastlane/report.xml 81 | fastlane/Preview.html 82 | fastlane/screenshots/**/*.png 83 | fastlane/test_output 84 | 85 | # Code Injection 86 | # 87 | # After new code Injection tools there's a generated folder /iOSInjectionProject 88 | # https://github.com/johnno1962/injectionforxcode 89 | 90 | iOSInjectionProject/ 91 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Noah Gilmore 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NGSwiftUITableCellSizing.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A15E767524B365BC00FCDCCB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A15E767424B365BC00FCDCCB /* AppDelegate.swift */; }; 11 | A15E767724B365BC00FCDCCB /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A15E767624B365BC00FCDCCB /* SceneDelegate.swift */; }; 12 | A15E767924B365BC00FCDCCB /* CellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A15E767824B365BC00FCDCCB /* CellView.swift */; }; 13 | A15E767B24B365BE00FCDCCB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A15E767A24B365BE00FCDCCB /* Assets.xcassets */; }; 14 | A15E767E24B365BE00FCDCCB /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A15E767D24B365BE00FCDCCB /* Preview Assets.xcassets */; }; 15 | A15E768124B365BE00FCDCCB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A15E767F24B365BE00FCDCCB /* LaunchScreen.storyboard */; }; 16 | A15E768924B366B100FCDCCB /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A15E768824B366B100FCDCCB /* TableViewController.swift */; }; 17 | A15E768B24B4BDF700FCDCCB /* HostingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A15E768A24B4BDF700FCDCCB /* HostingCell.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | A15E767124B365BC00FCDCCB /* NGSwiftUITableCellSizing.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NGSwiftUITableCellSizing.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | A15E767424B365BC00FCDCCB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 23 | A15E767624B365BC00FCDCCB /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 24 | A15E767824B365BC00FCDCCB /* CellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CellView.swift; sourceTree = ""; }; 25 | A15E767A24B365BE00FCDCCB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | A15E767D24B365BE00FCDCCB /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 27 | A15E768024B365BE00FCDCCB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 28 | A15E768224B365BE00FCDCCB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29 | A15E768824B366B100FCDCCB /* TableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = ""; }; 30 | A15E768A24B4BDF700FCDCCB /* HostingCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HostingCell.swift; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | A15E766E24B365BC00FCDCCB /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | A15E766824B365BC00FCDCCB = { 45 | isa = PBXGroup; 46 | children = ( 47 | A15E767324B365BC00FCDCCB /* NGSwiftUITableCellSizing */, 48 | A15E767224B365BC00FCDCCB /* Products */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | A15E767224B365BC00FCDCCB /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | A15E767124B365BC00FCDCCB /* NGSwiftUITableCellSizing.app */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | A15E767324B365BC00FCDCCB /* NGSwiftUITableCellSizing */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | A15E767424B365BC00FCDCCB /* AppDelegate.swift */, 64 | A15E767624B365BC00FCDCCB /* SceneDelegate.swift */, 65 | A15E767824B365BC00FCDCCB /* CellView.swift */, 66 | A15E767A24B365BE00FCDCCB /* Assets.xcassets */, 67 | A15E767F24B365BE00FCDCCB /* LaunchScreen.storyboard */, 68 | A15E768224B365BE00FCDCCB /* Info.plist */, 69 | A15E767C24B365BE00FCDCCB /* Preview Content */, 70 | A15E768824B366B100FCDCCB /* TableViewController.swift */, 71 | A15E768A24B4BDF700FCDCCB /* HostingCell.swift */, 72 | ); 73 | path = NGSwiftUITableCellSizing; 74 | sourceTree = ""; 75 | }; 76 | A15E767C24B365BE00FCDCCB /* Preview Content */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | A15E767D24B365BE00FCDCCB /* Preview Assets.xcassets */, 80 | ); 81 | path = "Preview Content"; 82 | sourceTree = ""; 83 | }; 84 | /* End PBXGroup section */ 85 | 86 | /* Begin PBXNativeTarget section */ 87 | A15E767024B365BC00FCDCCB /* NGSwiftUITableCellSizing */ = { 88 | isa = PBXNativeTarget; 89 | buildConfigurationList = A15E768524B365BE00FCDCCB /* Build configuration list for PBXNativeTarget "NGSwiftUITableCellSizing" */; 90 | buildPhases = ( 91 | A15E766D24B365BC00FCDCCB /* Sources */, 92 | A15E766E24B365BC00FCDCCB /* Frameworks */, 93 | A15E766F24B365BC00FCDCCB /* Resources */, 94 | ); 95 | buildRules = ( 96 | ); 97 | dependencies = ( 98 | ); 99 | name = NGSwiftUITableCellSizing; 100 | productName = NGSwiftUITableCellSizing; 101 | productReference = A15E767124B365BC00FCDCCB /* NGSwiftUITableCellSizing.app */; 102 | productType = "com.apple.product-type.application"; 103 | }; 104 | /* End PBXNativeTarget section */ 105 | 106 | /* Begin PBXProject section */ 107 | A15E766924B365BC00FCDCCB /* Project object */ = { 108 | isa = PBXProject; 109 | attributes = { 110 | LastSwiftUpdateCheck = 1200; 111 | LastUpgradeCheck = 1200; 112 | TargetAttributes = { 113 | A15E767024B365BC00FCDCCB = { 114 | CreatedOnToolsVersion = 12.0; 115 | }; 116 | }; 117 | }; 118 | buildConfigurationList = A15E766C24B365BC00FCDCCB /* Build configuration list for PBXProject "NGSwiftUITableCellSizing" */; 119 | compatibilityVersion = "Xcode 9.3"; 120 | developmentRegion = en; 121 | hasScannedForEncodings = 0; 122 | knownRegions = ( 123 | en, 124 | Base, 125 | ); 126 | mainGroup = A15E766824B365BC00FCDCCB; 127 | productRefGroup = A15E767224B365BC00FCDCCB /* Products */; 128 | projectDirPath = ""; 129 | projectRoot = ""; 130 | targets = ( 131 | A15E767024B365BC00FCDCCB /* NGSwiftUITableCellSizing */, 132 | ); 133 | }; 134 | /* End PBXProject section */ 135 | 136 | /* Begin PBXResourcesBuildPhase section */ 137 | A15E766F24B365BC00FCDCCB /* Resources */ = { 138 | isa = PBXResourcesBuildPhase; 139 | buildActionMask = 2147483647; 140 | files = ( 141 | A15E768124B365BE00FCDCCB /* LaunchScreen.storyboard in Resources */, 142 | A15E767E24B365BE00FCDCCB /* Preview Assets.xcassets in Resources */, 143 | A15E767B24B365BE00FCDCCB /* Assets.xcassets in Resources */, 144 | ); 145 | runOnlyForDeploymentPostprocessing = 0; 146 | }; 147 | /* End PBXResourcesBuildPhase section */ 148 | 149 | /* Begin PBXSourcesBuildPhase section */ 150 | A15E766D24B365BC00FCDCCB /* Sources */ = { 151 | isa = PBXSourcesBuildPhase; 152 | buildActionMask = 2147483647; 153 | files = ( 154 | A15E768B24B4BDF700FCDCCB /* HostingCell.swift in Sources */, 155 | A15E767524B365BC00FCDCCB /* AppDelegate.swift in Sources */, 156 | A15E767724B365BC00FCDCCB /* SceneDelegate.swift in Sources */, 157 | A15E767924B365BC00FCDCCB /* CellView.swift in Sources */, 158 | A15E768924B366B100FCDCCB /* TableViewController.swift in Sources */, 159 | ); 160 | runOnlyForDeploymentPostprocessing = 0; 161 | }; 162 | /* End PBXSourcesBuildPhase section */ 163 | 164 | /* Begin PBXVariantGroup section */ 165 | A15E767F24B365BE00FCDCCB /* LaunchScreen.storyboard */ = { 166 | isa = PBXVariantGroup; 167 | children = ( 168 | A15E768024B365BE00FCDCCB /* Base */, 169 | ); 170 | name = LaunchScreen.storyboard; 171 | sourceTree = ""; 172 | }; 173 | /* End PBXVariantGroup section */ 174 | 175 | /* Begin XCBuildConfiguration section */ 176 | A15E768324B365BE00FCDCCB /* Debug */ = { 177 | isa = XCBuildConfiguration; 178 | buildSettings = { 179 | ALWAYS_SEARCH_USER_PATHS = NO; 180 | CLANG_ANALYZER_NONNULL = YES; 181 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 182 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 183 | CLANG_CXX_LIBRARY = "libc++"; 184 | CLANG_ENABLE_MODULES = YES; 185 | CLANG_ENABLE_OBJC_ARC = YES; 186 | CLANG_ENABLE_OBJC_WEAK = YES; 187 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 188 | CLANG_WARN_BOOL_CONVERSION = YES; 189 | CLANG_WARN_COMMA = YES; 190 | CLANG_WARN_CONSTANT_CONVERSION = YES; 191 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 192 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 193 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 194 | CLANG_WARN_EMPTY_BODY = YES; 195 | CLANG_WARN_ENUM_CONVERSION = YES; 196 | CLANG_WARN_INFINITE_RECURSION = YES; 197 | CLANG_WARN_INT_CONVERSION = YES; 198 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 199 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 200 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 201 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 202 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 203 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 204 | CLANG_WARN_STRICT_PROTOTYPES = YES; 205 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 206 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 207 | CLANG_WARN_UNREACHABLE_CODE = YES; 208 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 209 | COPY_PHASE_STRIP = NO; 210 | DEBUG_INFORMATION_FORMAT = dwarf; 211 | ENABLE_STRICT_OBJC_MSGSEND = YES; 212 | ENABLE_TESTABILITY = YES; 213 | GCC_C_LANGUAGE_STANDARD = gnu11; 214 | GCC_DYNAMIC_NO_PIC = NO; 215 | GCC_NO_COMMON_BLOCKS = YES; 216 | GCC_OPTIMIZATION_LEVEL = 0; 217 | GCC_PREPROCESSOR_DEFINITIONS = ( 218 | "DEBUG=1", 219 | "$(inherited)", 220 | ); 221 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 222 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 223 | GCC_WARN_UNDECLARED_SELECTOR = YES; 224 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 225 | GCC_WARN_UNUSED_FUNCTION = YES; 226 | GCC_WARN_UNUSED_VARIABLE = YES; 227 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 228 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 229 | MTL_FAST_MATH = YES; 230 | ONLY_ACTIVE_ARCH = YES; 231 | SDKROOT = iphoneos; 232 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 233 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 234 | }; 235 | name = Debug; 236 | }; 237 | A15E768424B365BE00FCDCCB /* Release */ = { 238 | isa = XCBuildConfiguration; 239 | buildSettings = { 240 | ALWAYS_SEARCH_USER_PATHS = NO; 241 | CLANG_ANALYZER_NONNULL = YES; 242 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 243 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 244 | CLANG_CXX_LIBRARY = "libc++"; 245 | CLANG_ENABLE_MODULES = YES; 246 | CLANG_ENABLE_OBJC_ARC = YES; 247 | CLANG_ENABLE_OBJC_WEAK = YES; 248 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 249 | CLANG_WARN_BOOL_CONVERSION = YES; 250 | CLANG_WARN_COMMA = YES; 251 | CLANG_WARN_CONSTANT_CONVERSION = YES; 252 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 253 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 254 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 255 | CLANG_WARN_EMPTY_BODY = YES; 256 | CLANG_WARN_ENUM_CONVERSION = YES; 257 | CLANG_WARN_INFINITE_RECURSION = YES; 258 | CLANG_WARN_INT_CONVERSION = YES; 259 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 260 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 261 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 262 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 263 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 264 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 265 | CLANG_WARN_STRICT_PROTOTYPES = YES; 266 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 267 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 268 | CLANG_WARN_UNREACHABLE_CODE = YES; 269 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 270 | COPY_PHASE_STRIP = NO; 271 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 272 | ENABLE_NS_ASSERTIONS = NO; 273 | ENABLE_STRICT_OBJC_MSGSEND = YES; 274 | GCC_C_LANGUAGE_STANDARD = gnu11; 275 | GCC_NO_COMMON_BLOCKS = YES; 276 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 277 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 278 | GCC_WARN_UNDECLARED_SELECTOR = YES; 279 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 280 | GCC_WARN_UNUSED_FUNCTION = YES; 281 | GCC_WARN_UNUSED_VARIABLE = YES; 282 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 283 | MTL_ENABLE_DEBUG_INFO = NO; 284 | MTL_FAST_MATH = YES; 285 | SDKROOT = iphoneos; 286 | SWIFT_COMPILATION_MODE = wholemodule; 287 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 288 | VALIDATE_PRODUCT = YES; 289 | }; 290 | name = Release; 291 | }; 292 | A15E768624B365BE00FCDCCB /* Debug */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 296 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 297 | CODE_SIGN_STYLE = Automatic; 298 | DEVELOPMENT_ASSET_PATHS = "\"NGSwiftUITableCellSizing/Preview Content\""; 299 | DEVELOPMENT_TEAM = 29P3YRFLV5; 300 | ENABLE_PREVIEWS = YES; 301 | INFOPLIST_FILE = NGSwiftUITableCellSizing/Info.plist; 302 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 303 | LD_RUNPATH_SEARCH_PATHS = ( 304 | "$(inherited)", 305 | "@executable_path/Frameworks", 306 | ); 307 | PRODUCT_BUNDLE_IDENTIFIER = com.noahgilmore.NGSwiftUITableCellSizing; 308 | PRODUCT_NAME = "$(TARGET_NAME)"; 309 | SWIFT_VERSION = 5.0; 310 | TARGETED_DEVICE_FAMILY = "1,2"; 311 | }; 312 | name = Debug; 313 | }; 314 | A15E768724B365BE00FCDCCB /* Release */ = { 315 | isa = XCBuildConfiguration; 316 | buildSettings = { 317 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 318 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 319 | CODE_SIGN_STYLE = Automatic; 320 | DEVELOPMENT_ASSET_PATHS = "\"NGSwiftUITableCellSizing/Preview Content\""; 321 | DEVELOPMENT_TEAM = 29P3YRFLV5; 322 | ENABLE_PREVIEWS = YES; 323 | INFOPLIST_FILE = NGSwiftUITableCellSizing/Info.plist; 324 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 325 | LD_RUNPATH_SEARCH_PATHS = ( 326 | "$(inherited)", 327 | "@executable_path/Frameworks", 328 | ); 329 | PRODUCT_BUNDLE_IDENTIFIER = com.noahgilmore.NGSwiftUITableCellSizing; 330 | PRODUCT_NAME = "$(TARGET_NAME)"; 331 | SWIFT_VERSION = 5.0; 332 | TARGETED_DEVICE_FAMILY = "1,2"; 333 | }; 334 | name = Release; 335 | }; 336 | /* End XCBuildConfiguration section */ 337 | 338 | /* Begin XCConfigurationList section */ 339 | A15E766C24B365BC00FCDCCB /* Build configuration list for PBXProject "NGSwiftUITableCellSizing" */ = { 340 | isa = XCConfigurationList; 341 | buildConfigurations = ( 342 | A15E768324B365BE00FCDCCB /* Debug */, 343 | A15E768424B365BE00FCDCCB /* Release */, 344 | ); 345 | defaultConfigurationIsVisible = 0; 346 | defaultConfigurationName = Release; 347 | }; 348 | A15E768524B365BE00FCDCCB /* Build configuration list for PBXNativeTarget "NGSwiftUITableCellSizing" */ = { 349 | isa = XCConfigurationList; 350 | buildConfigurations = ( 351 | A15E768624B365BE00FCDCCB /* Debug */, 352 | A15E768724B365BE00FCDCCB /* Release */, 353 | ); 354 | defaultConfigurationIsVisible = 0; 355 | defaultConfigurationName = Release; 356 | }; 357 | /* End XCConfigurationList section */ 358 | }; 359 | rootObject = A15E766924B365BC00FCDCCB /* Project object */; 360 | } 361 | -------------------------------------------------------------------------------- /NGSwiftUITableCellSizing.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /NGSwiftUITableCellSizing.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /NGSwiftUITableCellSizing.xcodeproj/xcshareddata/xcschemes/NGSwiftUITableCellSizing.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /NGSwiftUITableCellSizing.xcodeproj/xcuserdata/noahgilmore.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | NGSwiftUITableCellSizing.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | A15E767024B365BC00FCDCCB 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NGSwiftUITableCellSizing/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // NGSwiftUITableCellSizing 4 | // 5 | // Created by Noah Gilmore on 7/6/20. 6 | // 7 | 8 | import UIKit 9 | 10 | @UIApplicationMain 11 | class AppDelegate: UIResponder, UIApplicationDelegate { 12 | 13 | 14 | 15 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 16 | // Override point for customization after application launch. 17 | return true 18 | } 19 | 20 | // MARK: UISceneSession Lifecycle 21 | 22 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 23 | // Called when a new scene session is being created. 24 | // Use this method to select a configuration to create the new scene with. 25 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 26 | } 27 | 28 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 29 | // Called when the user discards a scene session. 30 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 31 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 32 | } 33 | 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /NGSwiftUITableCellSizing/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /NGSwiftUITableCellSizing/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /NGSwiftUITableCellSizing/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /NGSwiftUITableCellSizing/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 | -------------------------------------------------------------------------------- /NGSwiftUITableCellSizing/CellView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // NGSwiftUITableCellSizing 4 | // 5 | // Created by Noah Gilmore on 7/6/20. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct CellView: View { 11 | let content: String 12 | let numberOfRepetitions: Int 13 | 14 | var body: some View { 15 | HStack(alignment: .center, spacing: 10) { 16 | Rectangle() 17 | .fill(Color(.opaqueSeparator)) 18 | .frame(width: 2) 19 | VStack(alignment: .leading, spacing: 4) { 20 | Text(self.content) 21 | .lineLimit(nil) 22 | Text(String(repeating: content + " ", count: numberOfRepetitions)) 23 | .font(.caption) 24 | .foregroundColor(Color(.secondaryLabel)) 25 | .lineLimit(nil) 26 | } 27 | .padding([.top, .bottom], 10) 28 | Spacer() 29 | } 30 | .padding([.leading, .trailing], 10) 31 | } 32 | } 33 | 34 | struct ComplicatedCellView: View { 35 | let value: Int 36 | 37 | var body: some View { 38 | VStack { 39 | HStack { 40 | VStack { 41 | Rectangle().fill(Color.green) 42 | .frame(width: 50, height: 50) 43 | Rectangle().fill(Color.red) 44 | .frame(width: 50, height: 50) 45 | Spacer() 46 | }.frame(minHeight: 100) 47 | Rectangle() 48 | .fill(Color.blue) 49 | .frame(minWidth: 100) 50 | VStack { 51 | Text(String(repeating: "Value ", count: value % 40) + "\(value % 40)") 52 | .lineLimit(nil) 53 | Rectangle().fill(Color.red).frame(width: 50, height: 50) 54 | Spacer() 55 | } 56 | } 57 | Button(action: {}, label: { 58 | Text("Tap me!") 59 | }).padding(.bottom, 5) 60 | } 61 | .border(Color.yellow) 62 | .padding() 63 | .frame(minHeight: 0, maxHeight: .infinity) 64 | .border(Color.purple) 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /NGSwiftUITableCellSizing/HostingCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HostingCell.swift 3 | // NGSwiftUITableCellSizing 4 | // 5 | // Created by Noah Gilmore on 7/7/20. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | import SwiftUI 11 | 12 | // sizeThatFits method 13 | //final class HostingCell: UITableViewCell { 14 | // private lazy var hostingController: UIHostingController = UIHostingController(rootView: nil) 15 | // 16 | // override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 17 | // super.init(style: style, reuseIdentifier: reuseIdentifier) 18 | // hostingController.view.backgroundColor = .clear 19 | // } 20 | // 21 | // required init?(coder aDecoder: NSCoder) { 22 | // fatalError("init(coder:) has not been implemented") 23 | // } 24 | // 25 | // override func sizeThatFits(_ size: CGSize) -> CGSize { 26 | // let size = hostingController.sizeThatFits(in: size) 27 | // print("Returning size \(size)") 28 | // return size 29 | // } 30 | // 31 | // override func layoutSubviews() { 32 | // super.layoutSubviews() 33 | // hostingController.view.frame.size = self.sizeThatFits(bounds.size) 34 | // } 35 | // 36 | // public func set(rootView: Content, parentController: UIViewController) { 37 | // self.hostingController.rootView = rootView 38 | // if !self.contentView.subviews.contains(hostingController.view) { 39 | // self.contentView.addSubview(hostingController.view) 40 | // } 41 | // } 42 | //} 43 | 44 | // Constraints method 45 | 46 | final class HostingCell: UITableViewCell { 47 | private let hostingController = UIHostingController(rootView: nil) 48 | 49 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 50 | super.init(style: style, reuseIdentifier: reuseIdentifier) 51 | hostingController.view.backgroundColor = .clear 52 | } 53 | 54 | required init?(coder aDecoder: NSCoder) { 55 | fatalError("init(coder:) has not been implemented") 56 | } 57 | 58 | func set(rootView: Content, parentController: UIViewController) { 59 | self.hostingController.rootView = rootView 60 | self.hostingController.view.invalidateIntrinsicContentSize() 61 | 62 | let requiresControllerMove = hostingController.parent != parentController 63 | if requiresControllerMove { 64 | parentController.addChild(hostingController) 65 | } 66 | 67 | if !self.contentView.subviews.contains(hostingController.view) { 68 | self.contentView.addSubview(hostingController.view) 69 | hostingController.view.translatesAutoresizingMaskIntoConstraints = false 70 | hostingController.view.leadingAnchor.constraint(equalTo: self.contentView.leadingAnchor).isActive = true 71 | hostingController.view.trailingAnchor.constraint(equalTo: self.contentView.trailingAnchor).isActive = true 72 | hostingController.view.topAnchor.constraint(equalTo: self.contentView.topAnchor).isActive = true 73 | hostingController.view.bottomAnchor.constraint(equalTo: self.contentView.bottomAnchor).isActive = true 74 | } 75 | 76 | if requiresControllerMove { 77 | hostingController.didMove(toParent: parentController) 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /NGSwiftUITableCellSizing/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 | 37 | 38 | 39 | 40 | UIApplicationSupportsIndirectInputEvents 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UISupportedInterfaceOrientations~ipad 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationPortraitUpsideDown 58 | UIInterfaceOrientationLandscapeLeft 59 | UIInterfaceOrientationLandscapeRight 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /NGSwiftUITableCellSizing/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /NGSwiftUITableCellSizing/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // NGSwiftUITableCellSizing 4 | // 5 | // Created by Noah Gilmore on 7/6/20. 6 | // 7 | 8 | import UIKit 9 | import SwiftUI 10 | 11 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | 16 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 17 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 18 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 19 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 20 | 21 | // Use a UIHostingController as window root view controller. 22 | if let windowScene = scene as? UIWindowScene { 23 | let window = UIWindow(windowScene: windowScene) 24 | window.rootViewController = TableViewController(style: .plain) 25 | self.window = window 26 | window.makeKeyAndVisible() 27 | } 28 | } 29 | 30 | func sceneDidDisconnect(_ scene: UIScene) { 31 | // Called as the scene is being released by the system. 32 | // This occurs shortly after the scene enters the background, or when its session is discarded. 33 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 34 | // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). 35 | } 36 | 37 | func sceneDidBecomeActive(_ scene: UIScene) { 38 | // Called when the scene has moved from an inactive state to an active state. 39 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 40 | } 41 | 42 | func sceneWillResignActive(_ scene: UIScene) { 43 | // Called when the scene will move from an active state to an inactive state. 44 | // This may occur due to temporary interruptions (ex. an incoming phone call). 45 | } 46 | 47 | func sceneWillEnterForeground(_ scene: UIScene) { 48 | // Called as the scene transitions from the background to the foreground. 49 | // Use this method to undo the changes made on entering the background. 50 | } 51 | 52 | func sceneDidEnterBackground(_ scene: UIScene) { 53 | // Called as the scene transitions from the foreground to the background. 54 | // Use this method to save data, release shared resources, and store enough scene-specific state information 55 | // to restore the scene back to its current state. 56 | } 57 | 58 | 59 | } 60 | 61 | -------------------------------------------------------------------------------- /NGSwiftUITableCellSizing/TableViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewController.swift 3 | // NGSwiftUITableCellSizing 4 | // 5 | // Created by Noah Gilmore on 7/6/20. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | final class TableViewController: UITableViewController { 12 | override init(style: UITableView.Style) { 13 | super.init(style: style) 14 | self.tableView.register(HostingCell.self, forCellReuseIdentifier: "HostingCell") 15 | self.tableView.register(HostingCell.self, forCellReuseIdentifier: "HostingCell") 16 | self.tableView.separatorStyle = .none 17 | } 18 | 19 | required init?(coder: NSCoder) { 20 | fatalError("init(coder:) has not been implemented") 21 | } 22 | 23 | override func numberOfSections(in tableView: UITableView) -> Int { 24 | return 1 25 | } 26 | 27 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 28 | return 300 29 | } 30 | 31 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 32 | if indexPath.row % 6 == 0 { 33 | let cell = tableView.dequeueReusableCell(withIdentifier: "HostingCell", for: indexPath) as! HostingCell 34 | cell.set(rootView: ComplicatedCellView(value: indexPath.row), parentController: self) 35 | return cell 36 | } else { 37 | let cell = tableView.dequeueReusableCell(withIdentifier: "HostingCell", for: indexPath) as! HostingCell 38 | cell.set(rootView: CellView(content: "Title Title Title ", numberOfRepetitions: indexPath.row % 20 + 1), parentController: self) 39 | return cell 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NGSwiftUITableCellSizing 2 | Demonstrates issues with SwiftUI views inside self sizing UITableViewCells 3 | --------------------------------------------------------------------------------