{"id":3134,"date":"2025-02-18T17:25:32","date_gmt":"2025-02-18T22:25:32","guid":{"rendered":"https:\/\/stepinto.vision\/?p=3134"},"modified":"2025-04-01T12:49:20","modified_gmt":"2025-04-01T16:49:20","slug":"realitykit-basics-attachments","status":"publish","type":"post","link":"https:\/\/stepinto.vision\/example-code\/realitykit-basics-attachments\/","title":{"rendered":"RealityKit Basics: attachments"},"content":{"rendered":"\n<p>We can create 2D SwiftUI attachments and add them to 3D scenes as entities.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Overview<\/h2>\n\n\n\n<p>Attachments in RealityKit are one of my favorite features. We can create SwiftUI views, then pass them into a RealityView as an attachment. When we retrieve them in the make or update closures, RealityKit transforms them into entities that we can use along with our other assets.<\/p>\n\n\n\n<p>Adding an attachment is always a two step process<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Define an attachment with an id and a view<\/li>\n\n\n\n<li>Retrieve the attachment by id and add it to the scene. We do this by calling <code>attachments.entity(for: )<\/code>.<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#000000;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"RealityView { content, attachments in\n    if let scene = try? await Entity(named: &quot;RKBasicsLoading&quot;, in: realityKitContentBundle) {\n        content.add(scene)\n        if let earth = scene.findEntity(named: &quot;Earth&quot;) {\n            \/\/ Step 2: Retrieve the attachment by id and add it to the scene\n            if let earthPanel = attachments.entity(for: &quot;EarthPanel&quot;) {\n                earth.addChild(earthPanel, preservingWorldTransform: true)\n                earthPanel.setPosition([0, -0.1, 0.1], relativeTo: earth)\n            }\n        }\n    }\n} update: { content, attachments in\n} attachments: {\n    \/\/ Step 1: Define an attachment with an id and a view\n    Attachment(id: &quot;EarthPanel&quot;) {\n        HStack {\n            Image(systemName: &quot;globe.europe.africa&quot;)\n            Text(&quot;Earth&quot;)\n                .font(.headline)\n        }\n        .padding()\n        .glassBackgroundEffect()\n    }\n}\" style=\"color:#000000;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki light-plus\" style=\"background-color: #FFFFFF\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #000000\">RealityView { content, attachments <\/span><span style=\"color: #AF00DB\">in<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #AF00DB\">if<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> scene = <\/span><span style=\"color: #AF00DB\">try<\/span><span style=\"color: #000000\">? <\/span><span style=\"color: #AF00DB\">await<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #795E26\">Entity<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">named<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;RKBasicsLoading&quot;<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #795E26\">in<\/span><span style=\"color: #000000\">: realityKitContentBundle) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        content.<\/span><span style=\"color: #795E26\">add<\/span><span style=\"color: #000000\">(scene)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        <\/span><span style=\"color: #AF00DB\">if<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> earth = scene.<\/span><span style=\"color: #795E26\">findEntity<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">named<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;Earth&quot;<\/span><span style=\"color: #000000\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            <\/span><span style=\"color: #008000\">\/\/ Step 2: Retrieve the attachment by id and add it to the scene<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            <\/span><span style=\"color: #AF00DB\">if<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> earthPanel = attachments.<\/span><span style=\"color: #795E26\">entity<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">for<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;EarthPanel&quot;<\/span><span style=\"color: #000000\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                earth.<\/span><span style=\"color: #795E26\">addChild<\/span><span style=\"color: #000000\">(earthPanel, <\/span><span style=\"color: #795E26\">preservingWorldTransform<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #0000FF\">true<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                earthPanel.<\/span><span style=\"color: #795E26\">setPosition<\/span><span style=\"color: #000000\">([<\/span><span style=\"color: #098658\">0<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #098658\">-0.1<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #098658\">0.1<\/span><span style=\"color: #000000\">], <\/span><span style=\"color: #795E26\">relativeTo<\/span><span style=\"color: #000000\">: earth)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">} update: { content, attachments <\/span><span style=\"color: #AF00DB\">in<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">} attachments: {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #008000\">\/\/ Step 1: Define an attachment with an id and a view<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #795E26\">Attachment<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">id<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;EarthPanel&quot;<\/span><span style=\"color: #000000\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        HStack {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            <\/span><span style=\"color: #795E26\">Image<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">systemName<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;globe.europe.africa&quot;<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            <\/span><span style=\"color: #795E26\">Text<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #A31515\">&quot;Earth&quot;<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                .<\/span><span style=\"color: #795E26\">font<\/span><span style=\"color: #000000\">(.<\/span><span style=\"color: #001080\">headline<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        .<\/span><span style=\"color: #795E26\">padding<\/span><span style=\"color: #000000\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        .<\/span><span style=\"color: #795E26\">glassBackgroundEffect<\/span><span style=\"color: #000000\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>We can work with attachments in two main ways.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>As child entities of other entities in our scene.<\/li>\n\n\n\n<li>As standalone entities in our scene<\/li>\n<\/ol>\n\n\n\n<p>We have examples of both here. This adds the earthPanel as a child of the earth entity.  <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#000000;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"if let earthPanel = attachments.entity(for: &quot;EarthPanel&quot;) {\n    \/\/ \u274c Don't add an attachment like this unless you want the SwiftUI content to scale with the entity\n    \/\/ earth.addChild(earthPanel)\n    \/\/ \u2705 Instead, use preservingWorldTransform to keep the attachment entity transform\/scale\n    earth.addChild(earthPanel, preservingWorldTransform: true)\n    earthPanel.setPosition([0, -0.1, 0.1], relativeTo: earth)\n}\" style=\"color:#000000;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki light-plus\" style=\"background-color: #FFFFFF\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #AF00DB\">if<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> earthPanel = attachments.<\/span><span style=\"color: #795E26\">entity<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">for<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;EarthPanel&quot;<\/span><span style=\"color: #000000\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #008000\">\/\/ \u274c Don&#39;t add an attachment like this unless you want the SwiftUI content to scale with the entity<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #008000\">\/\/ earth.addChild(earthPanel)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #008000\">\/\/ \u2705 Instead, use preservingWorldTransform to keep the attachment entity transform\/scale<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    earth.<\/span><span style=\"color: #795E26\">addChild<\/span><span style=\"color: #000000\">(earthPanel, <\/span><span style=\"color: #795E26\">preservingWorldTransform<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #0000FF\">true<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    earthPanel.<\/span><span style=\"color: #795E26\">setPosition<\/span><span style=\"color: #000000\">([<\/span><span style=\"color: #098658\">0<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #098658\">-0.1<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #098658\">0.1<\/span><span style=\"color: #000000\">], <\/span><span style=\"color: #795E26\">relativeTo<\/span><span style=\"color: #000000\">: earth)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Notice that we use <code>addChild(earthPanel, preservingWorldTransform: true)<\/code>. This will let us keep the intrinsic size and transform of the attachment entity, regardless of the parent. There are situations where you may want to scale the attachments with the parent though. For example, I do this for the text on the gravestones in Project Graveyard. In those cases, set <code>preservingWorldTransform<\/code> to false or use <code>addChild()<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" data-attachment-id=\"2797\" data-permalink=\"https:\/\/stepinto.vision\/articles\/step-into-newsletter-february-2-2025\/attachment\/pg-store-01\/\" data-orig-file=\"https:\/\/i0.wp.com\/stepinto.vision\/wp-content\/uploads\/2025\/02\/pg-store-01.jpeg?fit=3840%2C2160&amp;ssl=1\" data-orig-size=\"3840,2160\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"pg-store-01\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/stepinto.vision\/wp-content\/uploads\/2025\/02\/pg-store-01.jpeg?fit=1024%2C576&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/stepinto.vision\/wp-content\/uploads\/2025\/02\/pg-store-01.jpeg?resize=1024%2C576&#038;ssl=1\" alt=\"\" class=\"wp-image-2797\" srcset=\"https:\/\/i0.wp.com\/stepinto.vision\/wp-content\/uploads\/2025\/02\/pg-store-01.jpeg?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/stepinto.vision\/wp-content\/uploads\/2025\/02\/pg-store-01.jpeg?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/stepinto.vision\/wp-content\/uploads\/2025\/02\/pg-store-01.jpeg?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/stepinto.vision\/wp-content\/uploads\/2025\/02\/pg-store-01.jpeg?resize=1536%2C864&amp;ssl=1 1536w, https:\/\/i0.wp.com\/stepinto.vision\/wp-content\/uploads\/2025\/02\/pg-store-01.jpeg?resize=2048%2C1152&amp;ssl=1 2048w, https:\/\/i0.wp.com\/stepinto.vision\/wp-content\/uploads\/2025\/02\/pg-store-01.jpeg?resize=1200%2C675&amp;ssl=1 1200w, https:\/\/i0.wp.com\/stepinto.vision\/wp-content\/uploads\/2025\/02\/pg-store-01.jpeg?w=2580&amp;ssl=1 2580w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Attachments are scaled with the parent gravestone<\/figcaption><\/figure>\n\n\n\n<p>We can also add attachments as standalone entities in the scene.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#000000;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"RealityView { content, attachments in\n    if let scene = try? await Entity(named: &quot;RKBasicsLoading&quot;, in: realityKitContentBundle) {\n        content.add(scene)\n        \/\/ Get the attachment by id\n        if let titlePanel = attachments.entity(for: &quot;TitlePanel&quot;) {\n            \/\/ add it to the content\n            content.add(titlePanel)\n            titlePanel.setPosition([0, 0.2, -0.2], relativeTo: nil)\n        }\n    }\n} update: { content, attachments in\n} attachments: {\n    Attachment(id: &quot;TitlePanel&quot;) {\n        VStack {\n            Text(&quot;Earth &amp; Moon&quot;)\n                .font(.largeTitle)\n            Text(&quot;Best of friends for 4.53 billion years&quot;)\n                .font(.caption)\n        }\n        .padding()\n        .glassBackgroundEffect(in: .rect(cornerRadius: 24))\n    }\n}\" style=\"color:#000000;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki light-plus\" style=\"background-color: #FFFFFF\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #000000\">RealityView { content, attachments <\/span><span style=\"color: #AF00DB\">in<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #AF00DB\">if<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> scene = <\/span><span style=\"color: #AF00DB\">try<\/span><span style=\"color: #000000\">? <\/span><span style=\"color: #AF00DB\">await<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #795E26\">Entity<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">named<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;RKBasicsLoading&quot;<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #795E26\">in<\/span><span style=\"color: #000000\">: realityKitContentBundle) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        content.<\/span><span style=\"color: #795E26\">add<\/span><span style=\"color: #000000\">(scene)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        <\/span><span style=\"color: #008000\">\/\/ Get the attachment by id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        <\/span><span style=\"color: #AF00DB\">if<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> titlePanel = attachments.<\/span><span style=\"color: #795E26\">entity<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">for<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;TitlePanel&quot;<\/span><span style=\"color: #000000\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            <\/span><span style=\"color: #008000\">\/\/ add it to the content<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            content.<\/span><span style=\"color: #795E26\">add<\/span><span style=\"color: #000000\">(titlePanel)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            titlePanel.<\/span><span style=\"color: #795E26\">setPosition<\/span><span style=\"color: #000000\">([<\/span><span style=\"color: #098658\">0<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #098658\">0.2<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #098658\">-0.2<\/span><span style=\"color: #000000\">], <\/span><span style=\"color: #795E26\">relativeTo<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #0000FF\">nil<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">} update: { content, attachments <\/span><span style=\"color: #AF00DB\">in<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">} attachments: {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #795E26\">Attachment<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">id<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;TitlePanel&quot;<\/span><span style=\"color: #000000\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        VStack {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            <\/span><span style=\"color: #795E26\">Text<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #A31515\">&quot;Earth &amp; Moon&quot;<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                .<\/span><span style=\"color: #795E26\">font<\/span><span style=\"color: #000000\">(.<\/span><span style=\"color: #001080\">largeTitle<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            <\/span><span style=\"color: #795E26\">Text<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #A31515\">&quot;Best of friends for 4.53 billion years&quot;<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                .<\/span><span style=\"color: #795E26\">font<\/span><span style=\"color: #000000\">(.<\/span><span style=\"color: #001080\">caption<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        .<\/span><span style=\"color: #795E26\">padding<\/span><span style=\"color: #000000\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        .<\/span><span style=\"color: #795E26\">glassBackgroundEffect<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">in<\/span><span style=\"color: #000000\">: .<\/span><span style=\"color: #795E26\">rect<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">cornerRadius<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #098658\">24<\/span><span style=\"color: #000000\">))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Attachments are an incredibly powerful feature. They can display simple bits of data or more complex UI. Be away that many SwiftUI controls that rely on the presentation API are not supported in attachments. Common controls like picker require some additional work.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Full Example Code<\/h2>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#000000;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"struct Example050: View {\n    var body: some View {\n        RealityView { content, attachments in\n\n            if let scene = try? await Entity(named: &quot;RKBasicsLoading&quot;, in: realityKitContentBundle) {\n                content.add(scene)\n                scene.position.y = -0.4\n\n                if let earth = scene.findEntity(named: &quot;Earth&quot;), let moon = scene.findEntity(named: &quot;Moon&quot;) {\n\n                    if let earthPanel = attachments.entity(for: &quot;EarthPanel&quot;) {\n                        \/\/ \u274c Don't add an attachment like this unless you want the SwiftUI content to scale with the entity\n                        \/\/ earth.addChild(earthPanel)\n                        \/\/ \u2705 Instead, use preservingWorldTransform to keep the attachment entity transform\/scale\n                        earth.addChild(earthPanel, preservingWorldTransform: true)\n                        earthPanel.setPosition([0, -0.1, 0.1], relativeTo: earth)\n                    }\n\n                    if let moonPanel = attachments.entity(for: &quot;MoonPanel&quot;) {\n                        moon.addChild(moonPanel, preservingWorldTransform: true)\n                        moonPanel.setPosition([0, -0.05, 0.15], relativeTo: moon)\n                    }\n                }\n\n                if let titlePanel = attachments.entity(for: &quot;TitlePanel&quot;) {\n                    content.add(titlePanel)\n                    titlePanel.setPosition([0, 0.2, -0.2], relativeTo: nil)\n                }\n\n                \n            }\n\n        } update: { content, attachments in\n\n        } attachments: {\n\n            Attachment(id: &quot;EarthPanel&quot;) {\n                HStack {\n                    Image(systemName: &quot;globe.europe.africa&quot;)\n                    Text(&quot;Earth&quot;)\n                        .font(.headline)\n                }\n                .padding()\n                .glassBackgroundEffect()\n            }\n\n            Attachment(id: &quot;MoonPanel&quot;) {\n                HStack {\n                    Image(systemName: &quot;moon.circle.fill&quot;)\n                    Text(&quot;Moon&quot;)\n                        .font(.headline)\n                }\n                .padding()\n                .glassBackgroundEffect()\n            }\n\n            Attachment(id: &quot;TitlePanel&quot;) {\n                VStack {\n                    Text(&quot;Earth &amp; Moon&quot;)\n                        .font(.largeTitle)\n                    Text(&quot;Best of friends for 4.53 billion years&quot;)\n                        .font(.caption)\n                }\n                .padding()\n                .glassBackgroundEffect(in: .rect(cornerRadius: 24))\n            }\n        }\n    }\n}\" style=\"color:#000000;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki light-plus\" style=\"background-color: #FFFFFF\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #0000FF\">struct<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #267F99\">Example050<\/span><span style=\"color: #000000\">: View {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    <\/span><span style=\"color: #0000FF\">var<\/span><span style=\"color: #000000\"> body: some View {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        RealityView { content, attachments <\/span><span style=\"color: #AF00DB\">in<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            <\/span><span style=\"color: #AF00DB\">if<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> scene = <\/span><span style=\"color: #AF00DB\">try<\/span><span style=\"color: #000000\">? <\/span><span style=\"color: #AF00DB\">await<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #795E26\">Entity<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">named<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;RKBasicsLoading&quot;<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #795E26\">in<\/span><span style=\"color: #000000\">: realityKitContentBundle) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                content.<\/span><span style=\"color: #795E26\">add<\/span><span style=\"color: #000000\">(scene)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                scene.<\/span><span style=\"color: #001080\">position<\/span><span style=\"color: #000000\">.<\/span><span style=\"color: #001080\">y<\/span><span style=\"color: #000000\"> = <\/span><span style=\"color: #098658\">-0.4<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                <\/span><span style=\"color: #AF00DB\">if<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> earth = scene.<\/span><span style=\"color: #795E26\">findEntity<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">named<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;Earth&quot;<\/span><span style=\"color: #000000\">), <\/span><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> moon = scene.<\/span><span style=\"color: #795E26\">findEntity<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">named<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;Moon&quot;<\/span><span style=\"color: #000000\">) {<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                    <\/span><span style=\"color: #AF00DB\">if<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> earthPanel = attachments.<\/span><span style=\"color: #795E26\">entity<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">for<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;EarthPanel&quot;<\/span><span style=\"color: #000000\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                        <\/span><span style=\"color: #008000\">\/\/ \u274c Don&#39;t add an attachment like this unless you want the SwiftUI content to scale with the entity<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                        <\/span><span style=\"color: #008000\">\/\/ earth.addChild(earthPanel)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                        <\/span><span style=\"color: #008000\">\/\/ \u2705 Instead, use preservingWorldTransform to keep the attachment entity transform\/scale<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                        earth.<\/span><span style=\"color: #795E26\">addChild<\/span><span style=\"color: #000000\">(earthPanel, <\/span><span style=\"color: #795E26\">preservingWorldTransform<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #0000FF\">true<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                        earthPanel.<\/span><span style=\"color: #795E26\">setPosition<\/span><span style=\"color: #000000\">([<\/span><span style=\"color: #098658\">0<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #098658\">-0.1<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #098658\">0.1<\/span><span style=\"color: #000000\">], <\/span><span style=\"color: #795E26\">relativeTo<\/span><span style=\"color: #000000\">: earth)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                    }<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                    <\/span><span style=\"color: #AF00DB\">if<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> moonPanel = attachments.<\/span><span style=\"color: #795E26\">entity<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">for<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;MoonPanel&quot;<\/span><span style=\"color: #000000\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                        moon.<\/span><span style=\"color: #795E26\">addChild<\/span><span style=\"color: #000000\">(moonPanel, <\/span><span style=\"color: #795E26\">preservingWorldTransform<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #0000FF\">true<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                        moonPanel.<\/span><span style=\"color: #795E26\">setPosition<\/span><span style=\"color: #000000\">([<\/span><span style=\"color: #098658\">0<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #098658\">-0.05<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #098658\">0.15<\/span><span style=\"color: #000000\">], <\/span><span style=\"color: #795E26\">relativeTo<\/span><span style=\"color: #000000\">: moon)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                }<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                <\/span><span style=\"color: #AF00DB\">if<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #0000FF\">let<\/span><span style=\"color: #000000\"> titlePanel = attachments.<\/span><span style=\"color: #795E26\">entity<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">for<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;TitlePanel&quot;<\/span><span style=\"color: #000000\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                    content.<\/span><span style=\"color: #795E26\">add<\/span><span style=\"color: #000000\">(titlePanel)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                    titlePanel.<\/span><span style=\"color: #795E26\">setPosition<\/span><span style=\"color: #000000\">([<\/span><span style=\"color: #098658\">0<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #098658\">0.2<\/span><span style=\"color: #000000\">, <\/span><span style=\"color: #098658\">-0.2<\/span><span style=\"color: #000000\">], <\/span><span style=\"color: #795E26\">relativeTo<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #0000FF\">nil<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                }<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                <\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            }<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        } update: { content, attachments <\/span><span style=\"color: #AF00DB\">in<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        } attachments: {<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            <\/span><span style=\"color: #795E26\">Attachment<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">id<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;EarthPanel&quot;<\/span><span style=\"color: #000000\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                HStack {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                    <\/span><span style=\"color: #795E26\">Image<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">systemName<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;globe.europe.africa&quot;<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                    <\/span><span style=\"color: #795E26\">Text<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #A31515\">&quot;Earth&quot;<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                        .<\/span><span style=\"color: #795E26\">font<\/span><span style=\"color: #000000\">(.<\/span><span style=\"color: #001080\">headline<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                .<\/span><span style=\"color: #795E26\">padding<\/span><span style=\"color: #000000\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                .<\/span><span style=\"color: #795E26\">glassBackgroundEffect<\/span><span style=\"color: #000000\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            }<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            <\/span><span style=\"color: #795E26\">Attachment<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">id<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;MoonPanel&quot;<\/span><span style=\"color: #000000\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                HStack {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                    <\/span><span style=\"color: #795E26\">Image<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">systemName<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;moon.circle.fill&quot;<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                    <\/span><span style=\"color: #795E26\">Text<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #A31515\">&quot;Moon&quot;<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                        .<\/span><span style=\"color: #795E26\">font<\/span><span style=\"color: #000000\">(.<\/span><span style=\"color: #001080\">headline<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                .<\/span><span style=\"color: #795E26\">padding<\/span><span style=\"color: #000000\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                .<\/span><span style=\"color: #795E26\">glassBackgroundEffect<\/span><span style=\"color: #000000\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            }<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            <\/span><span style=\"color: #795E26\">Attachment<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">id<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #A31515\">&quot;TitlePanel&quot;<\/span><span style=\"color: #000000\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                VStack {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                    <\/span><span style=\"color: #795E26\">Text<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #A31515\">&quot;Earth &amp; Moon&quot;<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                        .<\/span><span style=\"color: #795E26\">font<\/span><span style=\"color: #000000\">(.<\/span><span style=\"color: #001080\">largeTitle<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                    <\/span><span style=\"color: #795E26\">Text<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #A31515\">&quot;Best of friends for 4.53 billion years&quot;<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                        .<\/span><span style=\"color: #795E26\">font<\/span><span style=\"color: #000000\">(.<\/span><span style=\"color: #001080\">caption<\/span><span style=\"color: #000000\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                .<\/span><span style=\"color: #795E26\">padding<\/span><span style=\"color: #000000\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">                .<\/span><span style=\"color: #795E26\">glassBackgroundEffect<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">in<\/span><span style=\"color: #000000\">: .<\/span><span style=\"color: #795E26\">rect<\/span><span style=\"color: #000000\">(<\/span><span style=\"color: #795E26\">cornerRadius<\/span><span style=\"color: #000000\">: <\/span><span style=\"color: #098658\">24<\/span><span style=\"color: #000000\">))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">            }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">        }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">}<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>We can create 2D SwiftUI attachments and add them to 3D scenes as entities.<\/p>\n","protected":false},"author":93705089,"featured_media":3135,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_EventAllDay":false,"_EventTimezone":"","_EventStartDate":"","_EventEndDate":"","_EventStartDateUTC":"","_EventEndDateUTC":"","_EventShowMap":false,"_EventShowMapLink":false,"_EventURL":"","_EventCost":"","_EventCostDescription":"","_EventCurrencySymbol":"","_EventCurrencyCode":"","_EventCurrencyPosition":"","_EventDateTimeSeparator":"","_EventTimeRangeSeparator":"","_EventOrganizerID":[],"_EventVenueID":[],"_OrganizerEmail":"","_OrganizerPhone":"","_OrganizerWebsite":"","_VenueAddress":"","_VenueCity":"","_VenueCountry":"","_VenueProvince":"","_VenueState":"","_VenueZip":"","_VenuePhone":"","_VenueURL":"","_VenueStateProvince":"","_VenueLat":"","_VenueLng":"","_VenueShowMap":false,"_VenueShowMapLink":false,"_kadence_starter_templates_imported_post":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2},"_wpas_customize_per_network":false,"jetpack_post_was_ever_published":false},"categories":[1365],"tags":[],"class_list":["post-3134","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-example-code"],"jetpack_publicize_connections":[],"taxonomy_info":{"category":[{"value":1365,"label":"Example Code"}]},"featured_image_src_large":["https:\/\/i0.wp.com\/stepinto.vision\/wp-content\/uploads\/2025\/02\/step-example-050-01.jpeg?fit=1024%2C768&ssl=1",1024,768,true],"author_info":{"display_name":"Joseph Simpson","author_link":"https:\/\/stepinto.vision\/author\/vrhermit\/"},"comment_info":0,"category_info":[{"term_id":1365,"name":"Example Code","slug":"example-code","term_group":0,"term_taxonomy_id":11,"taxonomy":"category","description":"Code snippets and examples of using common APIs throughout visionOS development","parent":0,"count":187,"filter":"raw","cat_ID":1365,"category_count":187,"category_description":"Code snippets and examples of using common APIs throughout visionOS development","cat_name":"Example Code","category_nicename":"example-code","category_parent":0}],"tag_info":false,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/stepinto.vision\/wp-content\/uploads\/2025\/02\/step-example-050-01.jpeg?fit=2732%2C2048&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/stepinto.vision\/wp-json\/wp\/v2\/posts\/3134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stepinto.vision\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stepinto.vision\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stepinto.vision\/wp-json\/wp\/v2\/users\/93705089"}],"replies":[{"embeddable":true,"href":"https:\/\/stepinto.vision\/wp-json\/wp\/v2\/comments?post=3134"}],"version-history":[{"count":14,"href":"https:\/\/stepinto.vision\/wp-json\/wp\/v2\/posts\/3134\/revisions"}],"predecessor-version":[{"id":3896,"href":"https:\/\/stepinto.vision\/wp-json\/wp\/v2\/posts\/3134\/revisions\/3896"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/stepinto.vision\/wp-json\/wp\/v2\/media\/3135"}],"wp:attachment":[{"href":"https:\/\/stepinto.vision\/wp-json\/wp\/v2\/media?parent=3134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stepinto.vision\/wp-json\/wp\/v2\/categories?post=3134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stepinto.vision\/wp-json\/wp\/v2\/tags?post=3134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}