├── README.md ├── sceneview.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── philipdavis.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist └── sceneview ├── 3dObjects ├── lowpoly.scn ├── lowpoly2.scn └── midpoly.scn ├── Assets.xcassets ├── AccentColor.colorset │ └── Contents.json ├── AppIcon.appiconset │ └── Contents.json └── Contents.json ├── ContentView.swift ├── Preview Content └── Preview Assets.xcassets │ └── Contents.json ├── SceneKit Scene.scn └── sceneviewApp.swift /README.md: -------------------------------------------------------------------------------- 1 | # swiftui-3dSceneView-example 2 | 3 | https://user-images.githubusercontent.com/3452573/157715118-dd14aeb9-d8e7-4c2f-bce8-e7299819efce.mov 4 | -------------------------------------------------------------------------------- /sceneview.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 55; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 483FD14C27D9D09800F25D30 /* 3dObjects in Resources */ = {isa = PBXBuildFile; fileRef = 483FD14B27D9D09800F25D30 /* 3dObjects */; }; 11 | 48A0FCC127D889D200ABDB89 /* sceneviewApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48A0FCC027D889D200ABDB89 /* sceneviewApp.swift */; }; 12 | 48A0FCC327D889D200ABDB89 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48A0FCC227D889D200ABDB89 /* ContentView.swift */; }; 13 | 48A0FCC527D889D300ABDB89 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 48A0FCC427D889D300ABDB89 /* Assets.xcassets */; }; 14 | 48A0FCC827D889D300ABDB89 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 48A0FCC727D889D300ABDB89 /* Preview Assets.xcassets */; }; 15 | 48A0FCD727D893D200ABDB89 /* SceneKit Scene.scn in Resources */ = {isa = PBXBuildFile; fileRef = 48A0FCD627D893D200ABDB89 /* SceneKit Scene.scn */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 483FD14B27D9D09800F25D30 /* 3dObjects */ = {isa = PBXFileReference; lastKnownFileType = folder; path = 3dObjects; sourceTree = ""; }; 20 | 48A0FCBD27D889D200ABDB89 /* sceneview.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = sceneview.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 48A0FCC027D889D200ABDB89 /* sceneviewApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = sceneviewApp.swift; sourceTree = ""; }; 22 | 48A0FCC227D889D200ABDB89 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 23 | 48A0FCC427D889D300ABDB89 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 24 | 48A0FCC727D889D300ABDB89 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 25 | 48A0FCD627D893D200ABDB89 /* SceneKit Scene.scn */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; path = "SceneKit Scene.scn"; sourceTree = ""; }; 26 | /* End PBXFileReference section */ 27 | 28 | /* Begin PBXFrameworksBuildPhase section */ 29 | 48A0FCBA27D889D200ABDB89 /* Frameworks */ = { 30 | isa = PBXFrameworksBuildPhase; 31 | buildActionMask = 2147483647; 32 | files = ( 33 | ); 34 | runOnlyForDeploymentPostprocessing = 0; 35 | }; 36 | /* End PBXFrameworksBuildPhase section */ 37 | 38 | /* Begin PBXGroup section */ 39 | 48A0FCB427D889D200ABDB89 = { 40 | isa = PBXGroup; 41 | children = ( 42 | 48A0FCBF27D889D200ABDB89 /* sceneview */, 43 | 48A0FCBE27D889D200ABDB89 /* Products */, 44 | ); 45 | sourceTree = ""; 46 | }; 47 | 48A0FCBE27D889D200ABDB89 /* Products */ = { 48 | isa = PBXGroup; 49 | children = ( 50 | 48A0FCBD27D889D200ABDB89 /* sceneview.app */, 51 | ); 52 | name = Products; 53 | sourceTree = ""; 54 | }; 55 | 48A0FCBF27D889D200ABDB89 /* sceneview */ = { 56 | isa = PBXGroup; 57 | children = ( 58 | 483FD14B27D9D09800F25D30 /* 3dObjects */, 59 | 48A0FCC027D889D200ABDB89 /* sceneviewApp.swift */, 60 | 48A0FCC227D889D200ABDB89 /* ContentView.swift */, 61 | 48A0FCD627D893D200ABDB89 /* SceneKit Scene.scn */, 62 | 48A0FCC427D889D300ABDB89 /* Assets.xcassets */, 63 | 48A0FCC627D889D300ABDB89 /* Preview Content */, 64 | ); 65 | path = sceneview; 66 | sourceTree = ""; 67 | }; 68 | 48A0FCC627D889D300ABDB89 /* Preview Content */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 48A0FCC727D889D300ABDB89 /* Preview Assets.xcassets */, 72 | ); 73 | path = "Preview Content"; 74 | sourceTree = ""; 75 | }; 76 | /* End PBXGroup section */ 77 | 78 | /* Begin PBXNativeTarget section */ 79 | 48A0FCBC27D889D200ABDB89 /* sceneview */ = { 80 | isa = PBXNativeTarget; 81 | buildConfigurationList = 48A0FCCB27D889D300ABDB89 /* Build configuration list for PBXNativeTarget "sceneview" */; 82 | buildPhases = ( 83 | 48A0FCB927D889D200ABDB89 /* Sources */, 84 | 48A0FCBA27D889D200ABDB89 /* Frameworks */, 85 | 48A0FCBB27D889D200ABDB89 /* Resources */, 86 | ); 87 | buildRules = ( 88 | ); 89 | dependencies = ( 90 | ); 91 | name = sceneview; 92 | productName = sceneview; 93 | productReference = 48A0FCBD27D889D200ABDB89 /* sceneview.app */; 94 | productType = "com.apple.product-type.application"; 95 | }; 96 | /* End PBXNativeTarget section */ 97 | 98 | /* Begin PBXProject section */ 99 | 48A0FCB527D889D200ABDB89 /* Project object */ = { 100 | isa = PBXProject; 101 | attributes = { 102 | BuildIndependentTargetsInParallel = 1; 103 | LastSwiftUpdateCheck = 1320; 104 | LastUpgradeCheck = 1320; 105 | TargetAttributes = { 106 | 48A0FCBC27D889D200ABDB89 = { 107 | CreatedOnToolsVersion = 13.2.1; 108 | }; 109 | }; 110 | }; 111 | buildConfigurationList = 48A0FCB827D889D200ABDB89 /* Build configuration list for PBXProject "sceneview" */; 112 | compatibilityVersion = "Xcode 13.0"; 113 | developmentRegion = en; 114 | hasScannedForEncodings = 0; 115 | knownRegions = ( 116 | en, 117 | Base, 118 | ); 119 | mainGroup = 48A0FCB427D889D200ABDB89; 120 | productRefGroup = 48A0FCBE27D889D200ABDB89 /* Products */; 121 | projectDirPath = ""; 122 | projectRoot = ""; 123 | targets = ( 124 | 48A0FCBC27D889D200ABDB89 /* sceneview */, 125 | ); 126 | }; 127 | /* End PBXProject section */ 128 | 129 | /* Begin PBXResourcesBuildPhase section */ 130 | 48A0FCBB27D889D200ABDB89 /* Resources */ = { 131 | isa = PBXResourcesBuildPhase; 132 | buildActionMask = 2147483647; 133 | files = ( 134 | 48A0FCD727D893D200ABDB89 /* SceneKit Scene.scn in Resources */, 135 | 48A0FCC827D889D300ABDB89 /* Preview Assets.xcassets in Resources */, 136 | 483FD14C27D9D09800F25D30 /* 3dObjects in Resources */, 137 | 48A0FCC527D889D300ABDB89 /* Assets.xcassets in Resources */, 138 | ); 139 | runOnlyForDeploymentPostprocessing = 0; 140 | }; 141 | /* End PBXResourcesBuildPhase section */ 142 | 143 | /* Begin PBXSourcesBuildPhase section */ 144 | 48A0FCB927D889D200ABDB89 /* Sources */ = { 145 | isa = PBXSourcesBuildPhase; 146 | buildActionMask = 2147483647; 147 | files = ( 148 | 48A0FCC327D889D200ABDB89 /* ContentView.swift in Sources */, 149 | 48A0FCC127D889D200ABDB89 /* sceneviewApp.swift in Sources */, 150 | ); 151 | runOnlyForDeploymentPostprocessing = 0; 152 | }; 153 | /* End PBXSourcesBuildPhase section */ 154 | 155 | /* Begin XCBuildConfiguration section */ 156 | 48A0FCC927D889D300ABDB89 /* Debug */ = { 157 | isa = XCBuildConfiguration; 158 | buildSettings = { 159 | ALWAYS_SEARCH_USER_PATHS = NO; 160 | CLANG_ANALYZER_NONNULL = YES; 161 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 162 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 163 | CLANG_CXX_LIBRARY = "libc++"; 164 | CLANG_ENABLE_MODULES = YES; 165 | CLANG_ENABLE_OBJC_ARC = YES; 166 | CLANG_ENABLE_OBJC_WEAK = YES; 167 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 168 | CLANG_WARN_BOOL_CONVERSION = YES; 169 | CLANG_WARN_COMMA = YES; 170 | CLANG_WARN_CONSTANT_CONVERSION = YES; 171 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 172 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 173 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 174 | CLANG_WARN_EMPTY_BODY = YES; 175 | CLANG_WARN_ENUM_CONVERSION = YES; 176 | CLANG_WARN_INFINITE_RECURSION = YES; 177 | CLANG_WARN_INT_CONVERSION = YES; 178 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 179 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 180 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 181 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 182 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 183 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 184 | CLANG_WARN_STRICT_PROTOTYPES = YES; 185 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 186 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 187 | CLANG_WARN_UNREACHABLE_CODE = YES; 188 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 189 | COPY_PHASE_STRIP = NO; 190 | DEBUG_INFORMATION_FORMAT = dwarf; 191 | ENABLE_STRICT_OBJC_MSGSEND = YES; 192 | ENABLE_TESTABILITY = YES; 193 | GCC_C_LANGUAGE_STANDARD = gnu11; 194 | GCC_DYNAMIC_NO_PIC = NO; 195 | GCC_NO_COMMON_BLOCKS = YES; 196 | GCC_OPTIMIZATION_LEVEL = 0; 197 | GCC_PREPROCESSOR_DEFINITIONS = ( 198 | "DEBUG=1", 199 | "$(inherited)", 200 | ); 201 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 202 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 203 | GCC_WARN_UNDECLARED_SELECTOR = YES; 204 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 205 | GCC_WARN_UNUSED_FUNCTION = YES; 206 | GCC_WARN_UNUSED_VARIABLE = YES; 207 | IPHONEOS_DEPLOYMENT_TARGET = 15.2; 208 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 209 | MTL_FAST_MATH = YES; 210 | ONLY_ACTIVE_ARCH = YES; 211 | SDKROOT = iphoneos; 212 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 213 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 214 | }; 215 | name = Debug; 216 | }; 217 | 48A0FCCA27D889D300ABDB89 /* Release */ = { 218 | isa = XCBuildConfiguration; 219 | buildSettings = { 220 | ALWAYS_SEARCH_USER_PATHS = NO; 221 | CLANG_ANALYZER_NONNULL = YES; 222 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 223 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 224 | CLANG_CXX_LIBRARY = "libc++"; 225 | CLANG_ENABLE_MODULES = YES; 226 | CLANG_ENABLE_OBJC_ARC = YES; 227 | CLANG_ENABLE_OBJC_WEAK = YES; 228 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 229 | CLANG_WARN_BOOL_CONVERSION = YES; 230 | CLANG_WARN_COMMA = YES; 231 | CLANG_WARN_CONSTANT_CONVERSION = YES; 232 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 233 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 234 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 235 | CLANG_WARN_EMPTY_BODY = YES; 236 | CLANG_WARN_ENUM_CONVERSION = YES; 237 | CLANG_WARN_INFINITE_RECURSION = YES; 238 | CLANG_WARN_INT_CONVERSION = YES; 239 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 240 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 241 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 242 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 243 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 244 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 245 | CLANG_WARN_STRICT_PROTOTYPES = YES; 246 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 247 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 248 | CLANG_WARN_UNREACHABLE_CODE = YES; 249 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 250 | COPY_PHASE_STRIP = NO; 251 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 252 | ENABLE_NS_ASSERTIONS = NO; 253 | ENABLE_STRICT_OBJC_MSGSEND = YES; 254 | GCC_C_LANGUAGE_STANDARD = gnu11; 255 | GCC_NO_COMMON_BLOCKS = YES; 256 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 257 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 258 | GCC_WARN_UNDECLARED_SELECTOR = YES; 259 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 260 | GCC_WARN_UNUSED_FUNCTION = YES; 261 | GCC_WARN_UNUSED_VARIABLE = YES; 262 | IPHONEOS_DEPLOYMENT_TARGET = 15.2; 263 | MTL_ENABLE_DEBUG_INFO = NO; 264 | MTL_FAST_MATH = YES; 265 | SDKROOT = iphoneos; 266 | SWIFT_COMPILATION_MODE = wholemodule; 267 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 268 | VALIDATE_PRODUCT = YES; 269 | }; 270 | name = Release; 271 | }; 272 | 48A0FCCC27D889D300ABDB89 /* Debug */ = { 273 | isa = XCBuildConfiguration; 274 | buildSettings = { 275 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 276 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 277 | CODE_SIGN_STYLE = Automatic; 278 | CURRENT_PROJECT_VERSION = 1; 279 | DEVELOPMENT_ASSET_PATHS = "\"sceneview/Preview Content\""; 280 | DEVELOPMENT_TEAM = X8UAQWJ2PH; 281 | ENABLE_PREVIEWS = YES; 282 | GENERATE_INFOPLIST_FILE = YES; 283 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 284 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 285 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 286 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 287 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 288 | LD_RUNPATH_SEARCH_PATHS = ( 289 | "$(inherited)", 290 | "@executable_path/Frameworks", 291 | ); 292 | MARKETING_VERSION = 1.0; 293 | PRODUCT_BUNDLE_IDENTIFIER = com.philipcdavis.sceneview; 294 | PRODUCT_NAME = "$(TARGET_NAME)"; 295 | SWIFT_EMIT_LOC_STRINGS = YES; 296 | SWIFT_VERSION = 5.0; 297 | TARGETED_DEVICE_FAMILY = "1,2"; 298 | }; 299 | name = Debug; 300 | }; 301 | 48A0FCCD27D889D300ABDB89 /* Release */ = { 302 | isa = XCBuildConfiguration; 303 | buildSettings = { 304 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 305 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 306 | CODE_SIGN_STYLE = Automatic; 307 | CURRENT_PROJECT_VERSION = 1; 308 | DEVELOPMENT_ASSET_PATHS = "\"sceneview/Preview Content\""; 309 | DEVELOPMENT_TEAM = X8UAQWJ2PH; 310 | ENABLE_PREVIEWS = YES; 311 | GENERATE_INFOPLIST_FILE = YES; 312 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 313 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 314 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 315 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 316 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 317 | LD_RUNPATH_SEARCH_PATHS = ( 318 | "$(inherited)", 319 | "@executable_path/Frameworks", 320 | ); 321 | MARKETING_VERSION = 1.0; 322 | PRODUCT_BUNDLE_IDENTIFIER = com.philipcdavis.sceneview; 323 | PRODUCT_NAME = "$(TARGET_NAME)"; 324 | SWIFT_EMIT_LOC_STRINGS = YES; 325 | SWIFT_VERSION = 5.0; 326 | TARGETED_DEVICE_FAMILY = "1,2"; 327 | }; 328 | name = Release; 329 | }; 330 | /* End XCBuildConfiguration section */ 331 | 332 | /* Begin XCConfigurationList section */ 333 | 48A0FCB827D889D200ABDB89 /* Build configuration list for PBXProject "sceneview" */ = { 334 | isa = XCConfigurationList; 335 | buildConfigurations = ( 336 | 48A0FCC927D889D300ABDB89 /* Debug */, 337 | 48A0FCCA27D889D300ABDB89 /* Release */, 338 | ); 339 | defaultConfigurationIsVisible = 0; 340 | defaultConfigurationName = Release; 341 | }; 342 | 48A0FCCB27D889D300ABDB89 /* Build configuration list for PBXNativeTarget "sceneview" */ = { 343 | isa = XCConfigurationList; 344 | buildConfigurations = ( 345 | 48A0FCCC27D889D300ABDB89 /* Debug */, 346 | 48A0FCCD27D889D300ABDB89 /* Release */, 347 | ); 348 | defaultConfigurationIsVisible = 0; 349 | defaultConfigurationName = Release; 350 | }; 351 | /* End XCConfigurationList section */ 352 | }; 353 | rootObject = 48A0FCB527D889D200ABDB89 /* Project object */; 354 | } 355 | -------------------------------------------------------------------------------- /sceneview.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /sceneview.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /sceneview.xcodeproj/xcuserdata/philipdavis.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | sceneview.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /sceneview/3dObjects/lowpoly.scn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philipcdavis/swiftui-3dSceneView-example/bfdd8579f7fc6b6425d5ad929296a2fadc8d3342/sceneview/3dObjects/lowpoly.scn -------------------------------------------------------------------------------- /sceneview/3dObjects/lowpoly2.scn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philipcdavis/swiftui-3dSceneView-example/bfdd8579f7fc6b6425d5ad929296a2fadc8d3342/sceneview/3dObjects/lowpoly2.scn -------------------------------------------------------------------------------- /sceneview/3dObjects/midpoly.scn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philipcdavis/swiftui-3dSceneView-example/bfdd8579f7fc6b6425d5ad929296a2fadc8d3342/sceneview/3dObjects/midpoly.scn -------------------------------------------------------------------------------- /sceneview/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 | -------------------------------------------------------------------------------- /sceneview/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 | -------------------------------------------------------------------------------- /sceneview/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /sceneview/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // sceneview 4 | // 5 | // Created by Philip Davis on 3/8/22. 6 | // 7 | 8 | import SwiftUI 9 | import SceneKit 10 | 11 | struct ContentView: View { 12 | var body: some View { 13 | VStack { 14 | SceneView(scene: SCNScene(named: "3dObjects/lowpoly.scn"), options: [.autoenablesDefaultLighting, .allowsCameraControl]) 15 | SceneView(scene: SCNScene(named: "3dObjects/midpoly.scn"), options: [.autoenablesDefaultLighting, .allowsCameraControl]) 16 | 17 | SceneView(scene: SCNScene(named: "3dObjects/lowpoly2.scn"), options: [.autoenablesDefaultLighting, .allowsCameraControl]) 18 | 19 | 20 | 21 | } 22 | } 23 | } 24 | 25 | struct ContentView_Previews: PreviewProvider { 26 | static var previews: some View { 27 | ContentView() 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /sceneview/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /sceneview/SceneKit Scene.scn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philipcdavis/swiftui-3dSceneView-example/bfdd8579f7fc6b6425d5ad929296a2fadc8d3342/sceneview/SceneKit Scene.scn -------------------------------------------------------------------------------- /sceneview/sceneviewApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // sceneviewApp.swift 3 | // sceneview 4 | // 5 | // Created by Philip Davis on 3/8/22. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct sceneviewApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | ContentView() 15 | } 16 | } 17 | } 18 | --------------------------------------------------------------------------------