{"id":3231,"date":"2023-06-09T12:10:06","date_gmt":"2023-06-09T16:10:06","guid":{"rendered":"https:\/\/michaelrowe01.com\/?p=3231"},"modified":"2023-06-09T12:10:08","modified_gmt":"2023-06-09T16:10:08","slug":"take-swiftui-to-the-next-dimension","status":"publish","type":"post","link":"https:\/\/michaelrowe01.com\/index.php\/blog\/take-swiftui-to-the-next-dimension\/","title":{"rendered":"Take SwiftUI to the next dimension"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"660\" height=\"371\" src=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-29.png?resize=660%2C371&#038;ssl=1\" alt=\"\" class=\"wp-image-3232\" srcset=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-29.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-29.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-29.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-29.png?resize=1536%2C864&amp;ssl=1 1536w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-29.png?w=1920&amp;ssl=1 1920w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-29.png?w=1320&amp;ssl=1 1320w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/figure>\n\n\n\n<p>This will review how to use a handful APIs to use Windows, Volumes, and Full Space<\/p>\n\n\n\n<p>Volumes<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This is used to emphasize 3D content.&nbsp; You get a fixed scaled container, which maintains the same size regardless of distance.<\/li>\n\n\n\n<li>You just use .windowStyle(.volumetric) to get started\u2026. It\u2019s that simple<\/li>\n<\/ul>\n\n\n\n<p>3D views and layout<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Model3D API is used to load usdz objects and more.&nbsp; It is similar to asyncImage&nbsp;<\/li>\n\n\n\n<li>There is a a phase to landing a Model3D,\n<ul class=\"wp-block-list\">\n<li>These include .empty, .failure, .success<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>You should use .scaleToFit() modifier so that the model can it within the volume<\/li>\n\n\n\n<li>By default alignment is back flush &#8211; so you want to use a .frame(depth: , alignment) modifier&nbsp;<\/li>\n\n\n\n<li>And than use .overlay to attach Labels<\/li>\n\n\n\n<li>Using a TimelineView you can add .animation to the 3D View so it has motion<\/li>\n<\/ul>\n\n\n\n<p>RealityView<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>For more complex scenes or experiences you should use RealityView instead of Model3D<\/li>\n\n\n\n<li>Using Entity\/Component system &#8211; check out \u201cBuild Spatial Experience with RealityKit\u201d and \u201cEnhance your spatial computing app with RealityKit\u201d<\/li>\n\n\n\n<li>Adding Attachments allow you to provide annotations relative to entities. You need to use any washable value for the .tag assigned to attachments\n<ul class=\"wp-block-list\">\n<li>.look(at: ) allow you to position and orient items&nbsp;<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>3D gestures<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>To interact with these entities you need to configure them for input, this is achieved by adding both InputTargetComponent and CollisionComponent so that you can add spatial tap gestures<\/li>\n\n\n\n<li>There is also a .targetedToEntity so that gestures will fail if they are not on the specific entity.&nbsp; Use .onEnded to retrieve the coordinates of the gesture.<\/li>\n\n\n\n<li>You can add a Model3D as an attachment to a RealityView entity , don\u2019t forget to add a .tag<\/li>\n\n\n\n<li>You can combine gestures in a Gesture Modifier to provide more functionality<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This will review how to use a handful APIs to use Windows, Volumes, and Full Space Volumes 3D views and layout RealityView 3D gestures<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_wp_convertkit_post_meta":{"form":"-1","landing_page":"0","tag":"0","restrict_content":"0"},"hide_page_title":"","footnotes":""},"categories":[2,3],"tags":[725,528,527,682,680,694],"class_list":["post-3231","post","type-post","status-publish","format-standard","hentry","category-blog","category-personal-softwareandit","tag-day-5","tag-realitykit","tag-swiftui","tag-visionos","tag-wwdc23","tag-xros-sdk"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts\/3231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/comments?post=3231"}],"version-history":[{"count":1,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts\/3231\/revisions"}],"predecessor-version":[{"id":3233,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts\/3231\/revisions\/3233"}],"wp:attachment":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/media?parent=3231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/categories?post=3231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/tags?post=3231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}