<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Anton’s Substack]]></title><description><![CDATA[My personal Substack (and that's true!) about iOS Development]]></description><link>https://antongubarenko.substack.com</link><image><url>https://substackcdn.com/image/fetch/$s_!mzA2!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1eb672de-f6cd-47a2-98b2-6de3f5be6ffe_2316x3088.jpeg</url><title>Anton’s Substack</title><link>https://antongubarenko.substack.com</link></image><generator>Substack</generator><lastBuildDate>Fri, 13 Nov 2026 05:30:08 GMT</lastBuildDate><atom:link href="https://antongubarenko.substack.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Anton Gubarenko]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[antongubarenko@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[antongubarenko@substack.com]]></itunes:email><itunes:name><![CDATA[Anton Gubarenko]]></itunes:name></itunes:owner><itunes:author><![CDATA[Anton Gubarenko]]></itunes:author><googleplay:owner><![CDATA[antongubarenko@substack.com]]></googleplay:owner><googleplay:email><![CDATA[antongubarenko@substack.com]]></googleplay:email><googleplay:author><![CDATA[Anton Gubarenko]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Swift Bits: Swift Tests Sequence]]></title><description><![CDATA[Run Tests in the way you need]]></description><link>https://antongubarenko.substack.com/p/swift-bits-swift-tests-sequence</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/swift-bits-swift-tests-sequence</guid><pubDate>Wed, 11 Nov 2026 11:37:36 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/e0bd63ee-10f0-466a-8011-a57f3b3b3604_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Ever had Swift tests that pass individually but randomly fail when you run the entire suite? &#129514;</p><p>One possible reason is <strong>parallel execution</strong>.</p><p>Swift Testing runs tests in parallel by default, which is great for performance but can cause problems when tests share mutable state, databases, or other resources.</p><p>That&#8217;s where <code>@Suite(.serialized)</code> comes in.</p><p>It forces tests within a suite to execute sequentially, making it particularly useful when migrating legacy XCTest code or dealing with tests that aren&#8217;t fully isolated yet.</p><p>But there&#8217;s a catch: <strong>serialization doesn&#8217;t guarantee execution order</strong>, and it doesn&#8217;t prevent unrelated suites from running concurrently.</p><p>I&#8217;ve put together a quick Swift Bits infographic explaining how <code>.serialized</code> works, when to use it, and why proper test isolation is still the better long-term solution.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0AaZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25f0ce25-a49f-4ebb-99fa-bf2eb51c8c3a_1800x2700.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0AaZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25f0ce25-a49f-4ebb-99fa-bf2eb51c8c3a_1800x2700.png 424w, https://substackcdn.com/image/fetch/$s_!0AaZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25f0ce25-a49f-4ebb-99fa-bf2eb51c8c3a_1800x2700.png 848w, https://substackcdn.com/image/fetch/$s_!0AaZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25f0ce25-a49f-4ebb-99fa-bf2eb51c8c3a_1800x2700.png 1272w, https://substackcdn.com/image/fetch/$s_!0AaZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25f0ce25-a49f-4ebb-99fa-bf2eb51c8c3a_1800x2700.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0AaZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25f0ce25-a49f-4ebb-99fa-bf2eb51c8c3a_1800x2700.png" width="728" height="1092" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/25f0ce25-a49f-4ebb-99fa-bf2eb51c8c3a_1800x2700.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2184,&quot;width&quot;:1456,&quot;resizeWidth&quot;:728,&quot;bytes&quot;:313036,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/224436794?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25f0ce25-a49f-4ebb-99fa-bf2eb51c8c3a_1800x2700.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0AaZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25f0ce25-a49f-4ebb-99fa-bf2eb51c8c3a_1800x2700.png 424w, https://substackcdn.com/image/fetch/$s_!0AaZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25f0ce25-a49f-4ebb-99fa-bf2eb51c8c3a_1800x2700.png 848w, https://substackcdn.com/image/fetch/$s_!0AaZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25f0ce25-a49f-4ebb-99fa-bf2eb51c8c3a_1800x2700.png 1272w, https://substackcdn.com/image/fetch/$s_!0AaZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F25f0ce25-a49f-4ebb-99fa-bf2eb51c8c3a_1800x2700.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>References</h2><ul><li><p><a href="https://developer.apple.com/documentation/Testing/Parallelization?changes=_4&amp;language=objc&amp;utm_source=chatgpt.com">Apple Documentation: Running tests serially or in parallel</a></p></li><li><p><a href="https://docs.swift.org/latest/documentation/testing/migratingfromxctest/?utm_source=chatgpt.com">Swift Testing: Migrating from XCTest</a> </p></li><li><p><a href="https://developer.apple.com/videos/play/wwdc2024/10195/?time=1&amp;utm_source=chatgpt.com">WWDC24: Go further with Swift Testing</a></p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[iOS 27: AVSystemRouting Framework]]></title><description><![CDATA[Beyond AirPlay: How iOS 27 Opens Media Routing to Third-Party TVs and Speakers]]></description><link>https://antongubarenko.substack.com/p/ios-27-avsystemrouting-framework</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/ios-27-avsystemrouting-framework</guid><dc:creator><![CDATA[Anton Gubarenko]]></dc:creator><pubDate>Tue, 10 Nov 2026 08:15:01 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/85c36de4-a608-4990-8a0b-e6a03532b900_1254x1254.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Here&#8217;s another iOS 27 update for media playback. In my previous article, <a href="https://antongubarenko.substack.com/p/ios-27-now-playing-framework?r=21t43r">iOS 27: Now Playing</a>, we explored how apps publish playback information and controls to the iPhone&#8217;s Lock Screen and Control Center. Now let&#8217;s go beyond the iPhone and look at sending media to another device.</p><p>We&#8217;ve been able to stream music to a HomePod or video to an Apple TV for years. That&#8217;s AirPlay: Apple&#8217;s established way to send media to compatible receivers. And yes, some third-party TVs and speakers support AirPlay too. But what about a TV, speaker, or streaming stick that uses a completely different media-sharing protocol? Historically, supporting it could mean integrating a manufacturer&#8217;s SDK, writing discovery code, and maintaining another set of playback controls.</p><p>That&#8217;s where <code>AVSystemRouting</code> comes in. In iOS 27, an app can work with system-managed routes to third-party receivers <strong>without bundling every device protocol&#8217;s SDK</strong>. The protocol provider implements a <code>MediaDevice</code> extension for discovery, connection, and playback; the media app handles route events and sessions through <code>AVSystemRouting</code>. It&#8217;s not a replacement for AirPlay or a way to make any random TV compatible. It&#8217;s a way to bring other protocols into the system&#8217;s media device picker.</p><p><strong>Which TVs and speakers are supported?</strong> Apple documents categories (TVs, speakers, and streaming devices) but doesn&#8217;t publish a verified list of brands or models compatible with this new extension-based routing. A receiver needs a working protocol integration supplied through a Media Device extension. AirPlay support alone does not establish <code>AVSystemRouting</code> compatibility, so I wouldn&#8217;t name specific products as supported without confirmation from their providers.</p><p><strong>One note before we start:</strong> this article is more of a technical overview than a full hands-on implementation. I don&#8217;t currently have a TV or speaker with a confirmed compatible Media Device extension to test against. We&#8217;ll walk through the APIs and architecture, but I won&#8217;t pretend the examples are a verified end-to-end streaming demo.</p><blockquote><p><strong>Availability:</strong> <code>AVSystemRouting</code> and its companion <code>MediaDevice</code> framework require iOS 27 or later. Apple&#8217;s routing guide says they aren&#8217;t available on Mac Catalyst or visionOS.</p></blockquote><div><hr></div><h2>Two Sides of the Same Connection</h2><p>There are two distinct parts to this integration.</p><p><strong>The media app</strong> uses <code>AVSystemRouting</code> to respond to route selection, create playback sessions, and control media.</p><p><strong>The Media Device extension</strong> uses <code>MediaDevice</code> to discover compatible receivers and translate system requests into the device&#8217;s own protocol. The extension may be shipped by the device or protocol provider.</p><p>The system sits between them:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!i3EM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F597ae473-c12e-459b-be76-69e09c4c0b40_1247x1261.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!i3EM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F597ae473-c12e-459b-be76-69e09c4c0b40_1247x1261.png 424w, https://substackcdn.com/image/fetch/$s_!i3EM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F597ae473-c12e-459b-be76-69e09c4c0b40_1247x1261.png 848w, https://substackcdn.com/image/fetch/$s_!i3EM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F597ae473-c12e-459b-be76-69e09c4c0b40_1247x1261.png 1272w, https://substackcdn.com/image/fetch/$s_!i3EM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F597ae473-c12e-459b-be76-69e09c4c0b40_1247x1261.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!i3EM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F597ae473-c12e-459b-be76-69e09c4c0b40_1247x1261.png" width="1247" height="1261" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/597ae473-c12e-459b-be76-69e09c4c0b40_1247x1261.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1261,&quot;width&quot;:1247,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1182303,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/222009107?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F597ae473-c12e-459b-be76-69e09c4c0b40_1247x1261.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!i3EM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F597ae473-c12e-459b-be76-69e09c4c0b40_1247x1261.png 424w, https://substackcdn.com/image/fetch/$s_!i3EM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F597ae473-c12e-459b-be76-69e09c4c0b40_1247x1261.png 848w, https://substackcdn.com/image/fetch/$s_!i3EM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F597ae473-c12e-459b-be76-69e09c4c0b40_1247x1261.png 1272w, https://substackcdn.com/image/fetch/$s_!i3EM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F597ae473-c12e-459b-be76-69e09c4c0b40_1247x1261.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The distinction matters. <code>AVSystemRouting</code> doesn&#8217;t magically discover every device on your network. Compatible devices need a provider&#8217;s Media Device extension, and your app needs to support the relevant routing capability. It also doesn&#8217;t turn a receiver into an AirPlay device; it gives third-party protocols a system-level route.</p><div><hr></div><h2>Start by Observing Routes</h2><p>The entry point on the app side is the shared <code>AVSystemRouteController</code>. Register an object conforming to <code>AVSystemRouteControllerObserver</code> and react when someone selects or deselects a device.</p><pre><code><code>import AVSystemRouting

final class RouteObserver: AVSystemRouteControllerObserver {
    func systemRouteController(
        _ controller: AVSystemRouteController,
        handle event: AVSystemRouteEvent
    ) async -&gt; Bool {
        switch event.reason {
        case .activate:
            return await startPlayback(on: event.route)

        case .deactivate:
            stopPlayback()
            return true

        @unknown default:
            return false
        }
    }
}

let observer = RouteObserver()
_ = AVSystemRouteController.shared.addObserver(observer)</code></code></pre><p>The Boolean result tells the controller whether your app handled the event. Keep the observer alive for as long as you expect routing events; the snippet shows registration, not a complete lifecycle implementation.</p><p>Notice what&#8217;s missing: device scanning. The media app responds to a system route; discovery is the extension provider&#8217;s responsibility.</p><div><hr></div><h2>A Route Isn&#8217;t a Playback Session</h2><p>An <code>AVSystemRoute</code> represents an active connection to a selected device. To play something, create an <code>AVSystemRouteSession</code>, add it to the route, and start it.</p><p>For a device with a built-in media player, use <code>.player</code>:</p><pre><code><code>func startPlayback(on route: AVSystemRoute) async -&gt; Bool {
    let url = URL(string: "&lt;https://example.com/media.m3u8&gt;")!
    let session = AVSystemRouteSession(url: url, mode: .player)

    guard route.addSession(session) else {
        return false
    }

    do {
        let mediaSession = try await session.start()
        // Retain the route, session, and mediaSession
        // for playback controls and later cleanup.
        return true
    } catch {
        route.removeSession(session)
        return false
    }
}</code></code></pre><p>The sequence is important: <strong>create &#8594; add &#8594; start</strong>. <code>addSession(_:) == false</code> means the route didn&#8217;t accept the session; a failed <code>start()</code> should remove it.</p><p><code>start()</code> gives you an <code>AVSystemRouteMediaSession</code>, which is your handle for remote playback state and control. In a real implementation, store the route and session rather than letting them disappear at the end of the function. When finished, stop the session and remove it from the route.</p><p>The URL in this example is a placeholder. The receiver needs to be able to access and play the actual media URL.</p><div><hr></div><h2>Two Launch Modes, Two Different Products</h2><p>The framework has two modes that look similar in code but imply different receiver behavior.</p><h3>Player mode</h3><pre><code><code>let session = AVSystemRouteSession(
    url: contentURL,
    mode: .player
)</code></code></pre><p>This asks the remote device to play the URL using its built-in player. You don&#8217;t need your own companion application on the receiver.</p><p>For this mode, set <code>MDESupportsUniversalURLPlayback</code> to <code>YES</code> in your app&#8217;s Info.plist. Apple&#8217;s documentation explicitly warns that starting a player-mode session fails without this declaration.</p><h3>Application mode</h3><pre><code><code>let session = AVSystemRouteSession(
    url: contentURL,
    mode: .application
)</code></code></pre><p>This launches your app&#8217;s counterpart on the remote device. It&#8217;s useful when the remote experience has its own UI, business logic, or application-specific messages.</p><p>For this mode, declare the supported protocol identifiers in <code>MDESupportedProtocols</code> in your app&#8217;s Info.plist. Those identifiers must match the protocol you actually support; don&#8217;t invent them.</p><p>The trade-off is straightforward: <strong>player mode delegates playback to the receiver; application mode delegates it to your receiver-side app</strong>. Pick based on what actually exists on the device, not on which initializer looks simpler.</p><div><hr></div><h2>Control Playback Without a Device-Specific SDK</h2><p>Once the session starts, <code>AVSystemRouteMediaSession.playbackControl</code> exposes an interface conforming to <code>AVInterfaceControllable</code>.</p><pre><code><code>func configurePlayback(
    for mediaSession: AVSystemRouteMediaSession
) {
    guard let control = mediaSession.playbackControl else {
        return
    }

    // Read remote state.
    let title = control.metadata.title
    let duration = control.timeRange.duration
    let isPlaying = control.isPlaying

    // Send changes to the remote player.
    control.currentPlaybackPosition = CMTime(
        seconds: 30,
        preferredTimescale: 600
    )
    control.playbackSpeed = 1.0
    control.volume = 0.8
}</code></code></pre><p>This is the useful abstraction: your app reads state and changes properties without speaking the device&#8217;s underlying protocol. Apple&#8217;s guide says the playback control supports Swift Observation, so you can use its state to drive a SwiftUI interface.</p><p>Those assignments aren&#8217;t guaranteed capabilities on every receiver. Build your controls around what the device and extension actually support.</p><p>There is an important integration boundary with the previous article about <strong>Now Playing</strong>: Apple&#8217;s <code>AVSystemRouting</code> guide discusses reporting playback metadata through <code>MPNowPlayingInfoCenter</code>, while the new Now Playing framework has its own session model and cautions against mixing local session APIs with the older Media Player interfaces. Treat these as distinct integration paths and verify the applicable guidance for your app&#8217;s session type before combining them.</p><div><hr></div><h2>The Data Channel Is for More Than Play and Pause</h2><p>Playback controls cover the standard transport UI. Application mode also gives you a way to exchange your own messages with the remote counterpart.</p><pre><code><code>class DataHandler: AVSystemRouteDataDelegate {
    func receive(_ data: Data) async throws {
        // Decode and handle an application-specific message.
    }
}

let handler = DataHandler()

func configureDataChannel(
    _ mediaSession: AVSystemRouteMediaSession
) {
    guard let channel = mediaSession.dataChannel else {
        return
    }

    channel.dataDelegate = handler
}

func sendCommand(
    _ command: Data,
    to mediaSession: AVSystemRouteMediaSession
) async throws {
    guard let channel = mediaSession.dataChannel else {
        return
    }

    try await channel.send(command)
}</code></code></pre><p>A data channel could carry something like a selected subtitle track, a custom queue action, or another command your receiver-side app understands. It isn&#8217;t a replacement for the standardized playback control interface.</p><p>The framework also exposes a route-level <code>routeDataChannel</code>, which exists independently of a playback session. <strong>Don&#8217;t assume session-scoped </strong><code>dataChannel</code><strong> is available in player mode</strong>: Apple&#8217;s detailed routing guide says it is <code>nil</code> there. Check for <code>nil</code> and use application mode when you need session-specific app-to-app messaging.</p><div><hr></div><h2>Creating a Media Device Extension</h2><p>The other half of this feature belongs to the <code>MediaDevice</code> framework. This isn&#8217;t an object you add to the SwiftUI app target: it&#8217;s a separate extension target that implements the provider side of the protocol.</p><p>Start with an iOS 27 app project and add a <strong>Media Device extension</strong> target using the extension template provided by your installed Xcode SDK. Configure its supported protocol and required capabilities. The app that consumes routes and the extension that supplies devices have different responsibilities; you may own both targets when building a proprietary receiver integration.</p><p>The extension needs to implement the <code>MediaDeviceExtension</code> entry point and provide the system with a routing manager. That manager must discover compatible receivers, report their identifiers, names, types and capabilities, establish connections, handle lifecycle changes, and translate playback requests into the actual receiver protocol. If your transport requires local network or Bluetooth access, configure the corresponding permissions and discovery declarations.</p><blockquote><p><strong>Important:</strong> Creating the extension target alone does not make a TV or speaker available. You must have a receiver with a protocol you can actually implement. A device that only supports AirPlay is not a test receiver for a custom third-party protocol extension.</p></blockquote><h3>Reporting a Discovered Receiver</h3><p>The following is the discovery-side example, not a complete extension implementation:</p><p>A protocol provider builds an extension conforming to <code>MediaDeviceExtension</code>. When the person opens the device picker, the system can ask that extension to discover compatible receivers. The extension uses the relevant transport&#8212;such as local networking, Bluetooth, or Wi-Fi Aware&#8212;and reports devices back to the system.</p><p>Apple&#8217;s guide illustrates a discovered receiver like this:</p><pre><code><code>let device = MediaOutputDevice(
    id: "5B5A455A-5FBA-55A7-9558-5155AB75A5B5",
    displayName: "Living Room TV",
    capabilities: [.realtimeAudioStreaming, .urlPlayback],
    deviceType: .tv
)

routingManager.foundDevice(device)</code></code></pre><p>This code belongs <strong>inside the provider&#8217;s extension</strong>, not in every media app that wants to route to the TV. The extension must also report devices that disappear, stop scanning when discovery ends, and handle session lifecycle and volume updates.</p><p>If discovery uses local networking or Bluetooth, the extension&#8217;s app must supply the relevant privacy descriptions and, where appropriate, Bonjour service declarations.</p><p>The key separation is what makes this architecture interesting: one provider can implement the protocol integration, and compatible playback apps can consume the resulting system routes.</p><div><hr></div><h2>Routing and Streaming Aren&#8217;t the Same Thing</h2><p>Apple&#8217;s longer guide also describes real-time audio/video streaming through a media device extension. That&#8217;s a different job from handing a receiver a URL.</p><p>With <strong>URL playback</strong>, the receiver gets a media URL and handles playback.</p><p>With <strong>real-time streaming</strong>, the extension participates in handling the actual media samples and transport. The <code>MediaDevice</code> side provides additional interfaces for that work, including <code>RealtimeSampleHandling</code>. You can&#8217;t turn the URL-session example above into a real-time streaming implementation by changing one launch-mode argument.</p><p>For an app developer, this is a useful boundary: decide whether the receiver can fetch and play your media, whether it needs a companion app, or whether your product truly needs live sample transport. Those lead to different extension requirements.</p><div><hr></div><h2>What You Need Before Testing</h2><p>The examples above explain the app-side API, but <strong>they aren&#8217;t a standalone demo that will discover arbitrary speakers</strong>.</p><p>To test an actual route, you need a compatible media device and its Media Device extension, a matching protocol configuration, and a reachable media resource or receiver-side app. For player-mode URL playback, enable <code>MDESupportsUniversalURLPlayback</code>. For application mode, configure <code>MDESupportedProtocols</code>.</p><p>Don&#8217;t confuse these with the audio background mode from a local <code>AVPlayer</code> demo. Background audio and third-party device routing solve different problems, and a background-audio entitlement alone doesn&#8217;t make remote routes appear.</p><p>I would test the happy path first, then device disappearance, failed <code>start()</code>, session removal, and reconnecting after a route change. Those are the cases that reveal whether the routing abstraction is actually working.</p><div><hr></div><h2>One Integration Point Instead of Many SDKs</h2><p>The best part of <code>AVSystemRouting</code> is not the number of methods. It&#8217;s the contract between three parties: the media app owns the content and playback UI; the provider owns device discovery and protocol behavior; iOS owns the route connecting them.</p><p>That&#8217;s also the limitation. The framework only delivers the promise when providers ship working extensions and apps adopt the route model. It doesn&#8217;t eliminate the underlying device protocols. It stops every media app from having to implement them independently.</p><p>For a platform that already has a strong built-in routing story, giving third-party receivers a system-level integration path is a meaningful addition.</p><div><hr></div><h2>Not-Complete Project&#128527;</h2><p>A complete end-to-end project has two targets:</p><ul><li><p><strong>SwiftUI routing app</strong> using <code>AVSystemRouting</code></p></li><li><p><strong>Media Device extension</strong> using <code>MediaDevice</code></p></li></ul><p>The app registers a route observer, retains the active <code>AVSystemRoute</code> and <code>AVSystemRouteSession</code>, starts a player-mode or application-mode session, exposes playback state, and cleans up when a route is deactivated. The extension discovers and reports receivers and implements the chosen device protocol.</p><h3>Swift 6 two-target reference example</h3><p>The following example separates the SwiftUI client from the provider extension and uses Swift 6 concurrency conventions. Set both targets to <strong>Swift Language Version: Swift 6</strong>, enable <strong>Complete</strong> strict concurrency checking, and deploy to <strong>iOS 27.0+</strong>. This is an architectural reference, <strong>not a tested, buildable end-to-end project</strong>: the Media Device extension still requires receiver-specific implementation and verification against the installed SDK.</p><p><strong>Project layout</strong></p><pre><code><code>MediaRoutingDemo/
&#9500;&#9472;&#9472; MediaRoutingApp/
&#9474;   &#9500;&#9472;&#9472; MediaRoutingApp.swift
&#9474;   &#9500;&#9472;&#9472; ContentView.swift
&#9474;   &#9492;&#9472;&#9472; RoutingManager.swift
&#9492;&#9472;&#9472; MediaDeviceExtension/
    &#9500;&#9472;&#9472; DemoMediaDeviceExtension.swift
    &#9492;&#9472;&#9472; ReceiverDiscovery.swift
</code></code></pre><p><strong>Target 1 - SwiftUI app</strong></p><p><code>MediaRoutingApp.swift</code>:</p><pre><code><code>import SwiftUI

@main
struct MediaRoutingApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}</code></code></pre><p><code>RoutingManager.swift</code> - isolate UI-facing mutable state to the main actor. Route events may arrive asynchronously; session lifecycle must clean up on errors and route removal.</p><pre><code><code>import AVSystemRouting
import Foundation
import Observation

@MainActor
@Observable
final class RoutingManager: AVSystemRouteControllerObserver {
    private(set) var status = "Waiting for a device"
    private(set) var isConnected = false
    private(set) var isPlaying = false

    @ObservationIgnored private var activeRoute: AVSystemRoute?
    @ObservationIgnored private var activeSession: AVSystemRouteSession?
    @ObservationIgnored private var mediaSession: AVSystemRouteMediaSession?

    private let mediaURL = URL(string: "&lt;https://example.com/media.m3u8&gt;")!

    init() {
        guard AVSystemRouteController.shared.addObserver(self) else {
            status = "Could not register route observer"
            return
        }
    }

    func systemRouteController(
        _ controller: AVSystemRouteController,
        handle event: AVSystemRouteEvent
    ) async -&gt; Bool {
        switch event.reason {
        case .activate:
            stop()
            activeRoute = event.route
            isConnected = true
            status = "Route activated"
            return await play()
        case .deactivate:
            stop()
            activeRoute = nil
            isConnected = false
            status = "Route deactivated"
            return true
        @unknown default:
            return false
        }
    }

    @discardableResult
    func play() async -&gt; Bool {
        guard let route = activeRoute else { return false }

        let session = AVSystemRouteSession(url: mediaURL, mode: .player)
        guard route.addSession(session) else {
            status = "Could not add session"
            return false
        }

        activeSession = session
        do {
            mediaSession = try await session.start()
            isPlaying = true
            status = "Playing remotely"
            return true
        } catch {
            session.stop()
            activeSession = nil
            mediaSession = nil
            isPlaying = false
            status = "Playback failed: \(error.localizedDescription)"
            return false
        }
    }

    func stop() {
        activeSession?.stop()
        activeSession = nil
        mediaSession = nil
        isPlaying = false
    }
}</code></code></pre><p><code>ContentView.swift</code>:</p><pre><code><code>import SwiftUI

struct ContentView: View {
    @State private var routing = RoutingManager()

    var body: some View {
        NavigationStack {
            VStack(spacing: 20) {
                Image(systemName: "hifispeaker")
                    .font(.system(size: 64))
                Text(routing.status)
                Button("Play on selected route") {
                    Task { await routing.play() }
                }
                .disabled(!routing.isConnected || routing.isPlaying)
                Button("Stop") { routing.stop() }
                    .disabled(!routing.isPlaying)
                Text("Choose a compatible receiver with the system route picker.")
                    .font(.footnote)
            }
            .padding()
            .navigationTitle("Media Routing")
        }
    }
}</code></code></pre><p>This UI does not yet embed the system route picker. Integrate the appropriate route picker for the chosen routing configuration, and confirm its availability in the iOS 27 SDK. The media URL must be reachable by the receiver. For player mode, set <code>MDESupportsUniversalURLPlayback</code> to <code>YES</code> in the app&#8217;s Info.plist.</p><p><strong>Target 2 - Media Device extension</strong></p><p>The extension is a <strong>separate target</strong>. It reports receivers to iOS and translates route/session operations into a protocol understood by the receiver. The following Swift 6 model keeps discovery transport separate from the Apple framework entry point.</p><p><code>ReceiverDiscovery.swift</code>:</p><pre><code><code>import Foundation

struct Receiver: Identifiable, Sendable {
    let id: String
    let name: String
    let host: String
    let port: Int
}

protocol ReceiverDiscovery: Sendable {
    func discover() async throws -&gt; [Receiver]
    func connect(to receiver: Receiver) async throws
    func disconnect(from receiver: Receiver) async
}</code></code></pre><p><code>DemoMediaDeviceExtension.swift</code> &#8212; <strong>illustrative extension skeleton; protocol requirements must be checked against the iOS 27 SDK</strong>:</p><pre><code><code>import MediaDevice
import UniformTypeIdentifiers

// Illustrative only: add the exact MediaDeviceExtension
// protocol requirements generated by the Xcode 27 template.
// Do not treat this as a complete protocol conformance.
@available(iOS 27.0, *)
final class DemoMediaDeviceExtension {
    let protocolType = UTType(
        exportedAs: "com.example.mediarouting"
    )

    // TODO: Provide the system's MediaDeviceExtension entry point.
    // TODO: Create and retain MediaDeviceRoutingManager.
    // TODO: Discover receivers and report MediaOutputDevice values.
    // TODO: Handle connection, activation, playback and removal.
}</code></code></pre><p>For example, after a receiver is discovered, the provider reports a <code>MediaOutputDevice</code> through its routing manager:</p><pre><code><code>let device = MediaOutputDevice(
    id: "5B5A455A-5FBA-55A7-9558-5155AB75A5B5",
    displayName: "Living Room TV",
    capabilities: [.realtimeAudioStreaming, .urlPlayback],
    deviceType: .tv
)

routingManager.foundDevice(device)</code></code></pre><p>The last snippet belongs inside the extension&#8217;s discovery implementation, where <code>routingManager</code> is the actual manager supplied by the framework. It is not standalone top-level code.</p><p><strong>Swift 6 concurrency considerations:</strong> keep UI state on <code>@MainActor</code>; use <code>Sendable</code> for values crossing isolation boundaries; avoid capturing non-Sendable framework objects in detached tasks; and follow the framework&#8217;s declared isolation for callbacks. Recheck the observer and extension method signatures against the final installed iOS 27 SDK before compiling.</p><p><strong>Before calling this a complete project:</strong> choose a real receiver and protocol, implement its Bonjour/network discovery and command transport, finish the extension&#8217;s required lifecycle callbacks, configure matching protocol identifiers and entitlements, add the system route picker, and test activation, playback, disappearance, failure, and reconnect. Neither a mock discovery list nor these snippets alone can create a functional remote route.</p><p>Both frameworks require <strong>iOS 27.0+</strong>; neither is available on Mac Catalyst or visionOS.</p><p>Happy coding and playing with this!</p><div><hr></div><h2>References</h2><ul><li><p><a href="https://developer.apple.com/documentation/avsystemrouting">Apple Developer Documentation: AVSystemRouting</a></p></li><li><p><a href="https://developer.apple.com/documentation/avsystemrouting/routing-media-to-third-party-devices">Routing media to third-party devices</a></p></li><li><p><a href="https://developer.apple.com/documentation/avsystemrouting/routing-and-streaming-media-to-remote-devices">Routing and streaming media to remote devices</a></p></li><li><p><a href="https://developer.apple.com/documentation/mediadevice">Media Device framework</a></p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[Apple Intelligence Group Lab 11/5/26 - Q&A]]></title><description><![CDATA[Direct answers from Apple Engineers]]></description><link>https://antongubarenko.substack.com/p/apple-intelligence-group-lab-11526</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/apple-intelligence-group-lab-11526</guid><dc:creator><![CDATA[Anton Gubarenko]]></dc:creator><pubDate>Fri, 06 Nov 2026 07:29:40 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/29ba499e-84b5-44bc-a479-8a07e7091060_1254x1254.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Another Apple Intelligence Group Lab, and the questions are already getting more specific. This one is also could be a Siri AI Lab, but more and more interest is shifted to the Foundation question.</p><p>This session focused on: how many Tool Intents to expose, why existing App Intents need an explicit opt-in, what happens when an app is in the background, and how Siri chooses between competing integrations. The discussion also covered skills, batching, privacy and Private Cloud Compute, long-running actions, testing, and Foundation Models.</p><blockquote><p>I tried to preserve the original wording and combine related answers where appropriate. However, some inaccuracies or mismatches are still possible.</p></blockquote><p>Enjoy!</p><div><hr></div><h2>Does exposing more App Intents make Siri worse at selecting the right one? Is there a recommended maximum?</h2><p>The panel stated a limit of 40 Tool Intents and recommended exposing only as many as needed for meaningful user actions. Keep each tool focused, such as searching for a product or adding it to a cart. Use Siri Evaluations to test whether the count, organization, descriptions, and parameter shapes lead to reliable selection; expect to iterate.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=307s">&#9201;&#65039; 05:07</a></p><div><hr></div><h2>Why must existing App Intents explicitly opt in to Siri AI, even if they are App Shortcuts?</h2><p>Natural-language tool selection is different from matching predefined App Shortcut phrases. Automatically exposing existing intents could work for obvious requests but fail for unusual phrasings. The explicit Tool Intent opt-in encourages developers to evaluate behavior before shipping. The panel described adoption as a small code change, supported by Siri Integration Advisor and Xcode coding-agent skills.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=439s">&#9201;&#65039; 07:19</a></p><div><hr></div><h2>Can Siri trigger an action without foregrounding the app, and what latency should developers expect?</h2><p>Yes, provided the app&#8217;s tools are available in Siri&#8217;s context&#8212;for example, when the app is named, is on screen, has an active Live Activity, or has an entity returned in search. An action can run through an App Intents extension instead of launching the full app. The panel said extensions are generally faster to start; if an intent is shared through a framework, the system can prefer an already-running host or otherwise launch the extension. No specific latency guarantee was given.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=666s">&#9201;&#65039; 11:06</a></p><div><hr></div><h2>If an iPhone app remotely controls a Mac app, where should its App Intents live?</h2><p>There is no automatic mechanism by which an intent invoked on the iPhone executes in the Mac app. The recommendation was to implement the intents natively on both platforms and handle any cross-device synchronization or remote command behavior within the apps.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=775s">&#9201;&#65039; 12:55</a></p><div><hr></div><h2>Can Tool Intents extract multiple values and infer units from one spoken request?</h2><p>Yes. Unlike the App Shortcut limitations discussed by the panel, Tool Intents can populate multiple parameters, including free-form strings. Good parameter titles and descriptions help Siri infer the intended values and units. For reusable groups of parameters, a generable AppEntity can represent a transient structured value that Siri creates on demand&#8212;for example, a flight-search request.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=824s">&#9201;&#65039; 13:44</a></p><div><hr></div><h2>How does Siri choose an app for a generic request, and how important are intent donations?</h2><p>For schema-based intents, the named app and the user&#8217;s history matter. Developers should donate equivalent actions performed through their app&#8217;s UI with IntentDonationManager so Siri can use that history as a routing signal. Custom Tool Intents are different: their availability is gated by context, such as the app being foregrounded or explicitly named, which reduces ambiguity. The panel did not describe a user-configurable default for arbitrary Tool Intents.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=1001s">&#9201;&#65039; 16:41</a></p><div><hr></div><h2>Are Siri Evaluations and Siri AI usage limits tied to the developer or the end user?</h2><p>The panel did not have a definitive answer. They asked developers to post the question on the developer forums so the appropriate team could respond.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=1117s">&#9201;&#65039; 18:37</a></p><div><hr></div><h2>How many tools can Siri chain, and when should developers use skills or batch operations?</h2><p>The panel said Siri can make up to 32 tool calls within a skill. They recommended batch-capable intents for operations over many entities, rather than making the planner call the same tool repeatedly. EntityCollection can efficiently pass identifiers without resolving full entities first. Siri can chain tools without a skill; add a skill for domain guidance or flexible sequences, not as a substitute for well-designed tools. If an exact A &#8594; B &#8594; C sequence must always occur, combine it into one deterministic tool.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=1158s">&#9201;&#65039; 19:18</a></p><div><hr></div><h2>How should developers refer to tools inside a Siri app skill?</h2><p>Use natural language rather than Swift type names or mangled identifiers. For example, refer to the &#8220;get car tool&#8221; rather than a specific App Intent type. Tool names, descriptions, and skill instructions should reinforce each other. The speakers emphasized that a skill guides the model but does not guarantee execution order or prevent Siri from calling a tool directly.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=1440s">&#9201;&#65039; 24:00</a></p><div><hr></div><h2>Why must an Open Intent target an AppEntity rather than a union value?</h2><p>The panel said the current design generally requires separate intents for different entity types. They were not sure whether the <a href="http://system.open/">system.open</a> schema could cover the scenario and recommended trying it, then filing feedback if it did not work.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=1542s">&#9201;&#65039; 25:42</a></p><div><hr></div><h2>When Siri calls a custom Tool Intent, what information leaves the device? Can it run entirely offline?</h2><p>The panel said Tool Intents use Siri processing through Private Cloud Compute (PCC), rather than operating fully on device. The request includes tool information and parameters and is handled under PCC&#8217;s encrypted, privacy-preserving architecture. Siri can still perform some on-device tasks without a connection, but Tool Intents are not supported offline in this preview.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=1606s">&#9201;&#65039; 26:46</a></p><div><hr></div><h2>Are Siri app skills limited on older Apple Intelligence-capable devices?</h2><p>The panel said there were no additional App Intents or app-skill limitations across supported Apple Intelligence devices such as iPhone 15 Pro and later. They distinguished this from Foundation Models running locally: available models and context-window sizes can differ by device.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=1690s">&#9201;&#65039; 28:10</a></p><div><hr></div><h2>Can developers use an LLM-as-judge to test Siri at scale? How should they structure tests?</h2><p>Siri Evaluations were described as scenario-based checks of Siri&#8217;s tool-selection trajectory, not an LLM-as-judge system. The separate Foundation Models Evaluations framework supports model judges. The recommended layering is to first use App Intents Testing for deterministic behavior&#8212;intent execution, queries, Spotlight indexing, and view annotations&#8212;then Siri Evaluations to test whether the model chooses and calls the right tools or skills. No specific retesting cadence was provided.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=1761s">&#9201;&#65039; 29:21</a></p><div><hr></div><h2>What can developers do when the Foundation Models context window is too small?</h2><p>The panel mentioned an 8K context window on newer devices rather than the older 4K limit. For larger contexts, developers can bring custom models through Core AI and the LanguageModel protocol; Gemma 4 was cited as an example with a much larger context on certain variants. They also suggested chunking data, trimming conversation history and tool outputs, using structured generables, and keeping tool and entity descriptions concise.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=1960s">&#9201;&#65039; 32:40</a></p><div><hr></div><h2>How can users discover what Siri can do with an app?</h2><p>Users can ask Siri what they can do with a particular app. The panel said this works with supported system apps and can reveal an app&#8217;s available tools, providing a quick way to check whether Siri recognizes an integration.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=2203s">&#9201;&#65039; 36:43</a></p><div><hr></div><h2>Can Siri reason over custom AppEntity properties in Tool Intents, beyond schema-defined fields?</h2><p>Yes. Tool Intents can use custom parameters and entity properties unless those properties are marked private. The panel nevertheless strongly recommended adopting an existing schema first for supported domains, because schemas can work without the app being named or foregrounded. Custom Tool Intents can extend the same entities with app-specific functionality.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=2255s">&#9201;&#65039; 37:35</a></p><div><hr></div><h2>Which Siri requests run on device, and what happens when the Mac is offline or PCC is unavailable?</h2><p>The panel reiterated that Tool Intents require PCC. If PCC cannot be reached, Siri cannot call those Tool Intents. They suggested using Siri Evaluations to investigate behavior under disconnected conditions. They did not establish a separate usage-limit fallback.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=2391s">&#9201;&#65039; 39:51</a></p><div><hr></div><h2>How should long-running Tool Intents communicate progress and cancellation?</h2><p>The panel pointed to the Long Running Intent API, which allows substantially longer execution than the usual short intent window. It provides explicit user-facing UI, cancellation, and progress reporting. The speakers did not confirm a precise Siri-specific timeout and also recommended keeping individual tools focused rather than creating unnecessarily long model round trips.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=2463s">&#9201;&#65039; 41:03</a></p><div><hr></div><h2>Can an on-device model power a private conversational driving assistant?</h2><p>The Foundation Models on-device model processes data locally, so a developer can build a conversation without sending location and trip information to a server through that model. Practical constraints include context length, conversation trimming, and latency. The panel suggested testing with the macOS FM command-line tool, evaluations, and Instruments, or bringing a different on-device model through Core AI when necessary.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=2569s">&#9201;&#65039; 42:49</a></p><div><hr></div><h2>How can Siri use active-trip context without exposing unnecessary location data?</h2><p>The question&#8217;s meaning of &#8220;exposing&#8221; was unclear to the panel. They suggested controlling which AppEntity properties Siri can see using property visibility, and applying authentication policies to intents, entities, and properties&#8212;especially for content that should not be available while the device is locked. Sensitive authorization checks still belong in app logic.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=2809s">&#9201;&#65039; 46:49</a></p><div><hr></div><h2>Can Siri generate complex configurations entirely on device, rather than just invoke predefined actions?</h2><p>Custom Tool Intents are not limited to the predefined schema actions. However, the panel clarified that the Siri Tool Intent path uses PCC, so it is not entirely on-device even if the app&#8217;s own execution is local.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=2958s">&#9201;&#65039; 49:18</a></p><div><hr></div><h2>How should developers surface Siri skills and capabilities to users?</h2><p>The panel recommended teaching capabilities rather than asking users to memorize exact invocation phrases or the concept of a &#8220;skill.&#8221; Users can ask Siri what an app can do. Developers can also introduce examples during onboarding or after an update. The panel did not identify an equivalent of the old Add to Shortcuts button specifically for skills.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=3007s">&#9201;&#65039; 50:07</a></p><div><hr></div><h2>What happens when someone invokes Siri on Apple Watch for a mirrored workout app whose Tool Intents are unavailable on watchOS?</h2><p>No concrete behavior was confirmed. The panel described this as a valuable developer-preview use case and asked developers to file feedback and discuss the scenario on the developer forums.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=3174s">&#9201;&#65039; 52:54</a></p><div><hr></div><h2>Can Foundation Models be an entirely offline inference backend for a third-party coding agent?</h2><p>The framework can be used in a local app-controlled workflow, but the panel explicitly did not recommend the built-in on-device Apple model for coding tasks. They suggested bringing a coding-capable model through Core AI, then using it via the Foundation Models interface. If inference uses a model running on the device, it can remain local. The speakers mentioned larger models on Macs and tool-calling agent workflows.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=3233s">&#9201;&#65039; 53:53</a></p><div><hr></div><h2>How can a navigation app support a hands-free request such as finding a gas station along a route?</h2><p>Start with the existing navigation schema and determine how much of the request it supports. Add Tool Intents for app-specific functionality that the schema does not cover. The panel did not present a complete implementation for this particular request.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=3362s">&#9201;&#65039; 56:02</a></p><div><hr></div><h2>How can developers reduce first-request latency for on-device Foundation Models?</h2><p>Use the prewarm API and profile actual latency, turns, and tool calls in Instruments. For custom Core AI models, ahead-of-time compilation can move some first-load work to build time. The panel gave no universal latency figure or chip-by-chip warm-up table.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=3420s">&#9201;&#65039; 57:00</a></p><div><hr></div><h2>Can developers enforce execution order and handle partial failures across chained intents?</h2><p>First define clear tools and descriptions and see how Siri orchestrates them. If domain-specific sequencing needs help, add a skill, but its instructions are not deterministic. When an invariant or hard dependency must always hold, combine the steps into one tool so the model cannot separate them. This also avoids some partial-failure scenarios.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=3508s">&#9201;&#65039; 58:28</a></p><div><hr></div><h2>How can a third-party app handle generic Siri requests without the user naming it?</h2><p>For schema-based intents, Siri can use interaction history and donated actions to select an app. Custom Tool Intents need an enabling context: the app is named, is foregrounded, has an active Live Activity, or has an entity in Siri&#8217;s context from search. The panel did not describe a general mechanism for arbitrary third-party tools to compete globally on unnamed requests.</p><p><a href="https://www.youtube.com/watch?v=Eb7fVwO2TAI&amp;t=3620s">&#9201;&#65039; 60:20</a></p><div><hr></div><h2>&#127942; Acknowledgments</h2><p>Thanks to <strong>Shashank, Matt, Karina, Kim, Justin, Michael</strong>, and the other engineers contributing to the discussion and behind-the-scenes question triage. Thanks also to everyone who submitted questions.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[Apple Intelligence Group Lab 11/4/26 - Q&A]]></title><description><![CDATA[Direct answers from Apple Engineers]]></description><link>https://antongubarenko.substack.com/p/apple-intelligence-group-lab-11426</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/apple-intelligence-group-lab-11426</guid><dc:creator><![CDATA[Anton Gubarenko]]></dc:creator><pubDate>Fri, 06 Nov 2026 07:06:55 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/05459d3d-0909-43c7-bdf7-4807fcf99d75_1254x1254.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>More Group Labs in our list. This time, Group Lab arrived right after the new Siri AI developer preview has been shipped, so it was no surprise that most of the questions focused on App Intents, Tool Intents, and skills. It&#8217;s more a Siri Group Lab, to be honest.</p><p>The discussion already goes well beyond the announcement: how Siri chooses between apps, when tools are available in the background, how to structure and test integrations, what can be indexed, and how developers should handle errors, security, and localization. There are also questions about Foundation Models context limits and Core AI compilation.</p><blockquote><p>I tried to preserve the original wording and combine related answers where appropriate. However, some inaccuracies or mismatches are still possible.</p></blockquote><p>Enjoy!</p><div><hr></div><h2>Can users write skills to guide Siri through tasks involving multiple apps?</h2><p>An app skill can describe how multiple tools work together within your app. The speaker advised against writing a skill that dictates how another app should be used. Skills can coordinate complex workflows among your own tools.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=264s">&#9201;&#65039; 04:24</a></p><div><hr></div><h2>Will Tool Intents replace App Intent schema domains, or will the domains expand?</h2><p>No future roadmap was given. Existing schemas remain useful and are not going away. They provide broad, reliable integration in supported domains without requiring developers to write and evaluate their own model-facing language. Schemas and custom Tool Intents can coexist in one app; a calendar app, for example, can use the calendar schema and add a custom action.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=327s">&#9201;&#65039; 05:27</a></p><div><hr></div><h2>When should a generable AppEntity be used instead of separate intent parameters?</h2><p>The example was creating a blog post with an optional poll. The post title and body can remain direct intent parameters, while the poll&#8217;s options and end date can be grouped in an optional generable entity. Siri can populate that entity&#8217;s properties. The concept resembles guided generation in Foundation Models.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=424s">&#9201;&#65039; 07:04</a></p><div><hr></div><h2>Do custom titles and descriptions matter for properties in schema-based AppEntity types?</h2><p>For properties defined by an existing schema, custom titles and descriptions were described as useful for Shortcuts presentation but not for Siri. For the new Tool Intents, titles and descriptions are used by Siri to understand parameters and select tools. Improving that metadata can improve behavior, and Xcode&#8217;s integration advisor can help review it.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=518s">&#9201;&#65039; 08:38</a></p><div><hr></div><h2>How does Siri choose between a third-party app and a system app when both can handle a request?</h2><p>For schema-based intents, the foreground app is a routing signal even if the user does not name it. For Tool Intents, foregrounding brings the app&#8217;s tools into consideration. An app can also expose entities from its visible views using view annotations, including custom non-schema entities.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=631s">&#9201;&#65039; 10:31</a></p><div><hr></div><h2>Can Siri call an app&#8217;s Tool Intents when the app is not in the foreground?</h2><p>Yes. The panel identified four ways tools can enter Siri&#8217;s context: the app is foregrounded; the user names the app; the app has an active Live Activity; or one of its entities is already in context, often through search. For example, finding a note indexed by a third-party notes app can make that app&#8217;s actions available. Similar conditions apply to skills.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=733s">&#9201;&#65039; 12:13</a></p><div><hr></div><h2>How does Siri rank similar tools across apps, including Notes or Mail?</h2><p>For schema-based intents, foregrounding and interaction history matter. Interaction history includes app launches and intent donations. Siri automatically records interactions performed through Siri, but actions taken directly in the app&#8217;s UI can be donated using IntentDonationManager. Donations are a signal, not a guarantee of selection. The speakers pointed to prior WWDC sessions and donation API documentation.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=805s">&#9201;&#65039; 13:25</a></p><div><hr></div><h2>How can an app integrate with Siri without indexing all its data in Spotlight?</h2><p>IndexedEntity is the recommended approach when possible. Some existing schema domains support queries instead, which is useful for a media app with a catalog too large to index locally. For Tool Intents, the panel also mentioned dynamic option providers and enumerable entities. String queries were not supported in the discussed preview. A Tool Intent can also take a string prompt and pass it to Foundation Models, Core AI, or a server-side model.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=919s">&#9201;&#65039; 15:19</a></p><div><hr></div><h2>Can a navigation app run Neural Engine TTS inference while locked and playing audio?</h2><p>The panel did not confirm whether the new background-inference entitlement covers this case. They said the answer depends on Neural Engine background policies and invited a follow-up on the developer forums.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=1134s">&#9201;&#65039; 18:54</a></p><div><hr></div><h2>How do you create a Siri app skill, and how do you refer to tools inside its <a href="http://skill.md/">skill.md</a>?</h2><p>In Xcode, create a new skills-bundle resource. The bundle contains <a href="http://skill.md/">skill.md</a> files with YAML front matter and Markdown bodies. Refer to tools using natural-language names, such as &#8220;create blog post tool,&#8221; rather than Swift type names. Xcode also includes coding-agent skills to help create Siri integrations. External command-line agents need those coding-agent skills installed separately.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=1182s">&#9201;&#65039; 19:42</a></p><div><hr></div><h2>If two apps are open on iPhone Duo, which app&#8217;s Tool Intents can Siri consider?</h2><p>Both foreground apps can be considered. Foreground status is not an overriding signal that forces Siri to choose only the last-used app. The answer did not establish any separate behavior for apps explicitly joined together by the user.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=1349s">&#9201;&#65039; 22:29</a></p><div><hr></div><h2>What protections are available when Siri-triggered actions change or delete data?</h2><p>For disruptive, irreversible, or physical-world actions, the speakers recommended requesting user confirmation inside the intent&#8217;s perform method. The existing confirmation API pauses execution, asks the user, and continues or cancels based on the answer. Authorization and safety checks belong in application logic, not solely in model behavior.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=1388s">&#9201;&#65039; 23:08</a></p><div><hr></div><h2>What should happen when someone taps an app entity shown in Siri?</h2><p>The panel expected a tap in the Siri canvas or Dynamic Island to open the entity by invoking a matching Open Intent. They also expected that behavior when the app was already visible. If the intent is not invoked, they suggested filing a bug.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=1464s">&#9201;&#65039; 24:24</a></p><div><hr></div><h2>Should developers still write App Shortcut phrases, or rely on Tool Intents?</h2><p>For Siri interactions, the speaker leaned toward Tool Intents, which can map flexible natural-language requests without a hand-authored phrase for every variation. Existing App Shortcuts can remain in place, and their underlying intents can also become tools. Previously written shortcut phrases are useful starting scenarios for Siri Evaluations, where developers can test many phrasings and assert expected tool calls.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=1530s">&#9201;&#65039; 25:30</a></p><div><hr></div><h2>For a new integration in an existing schema domain, should developers use the schema or Tool Intents?</h2><p>The recommendation was emphatically to adopt the existing schema first. Schema-based capabilities can be invoked without the Tool Intent conditions, such as foregrounding or naming the app. They also have established behavior in Siri without developers having to write tool descriptions or skills. Add custom Tool Intents where the app needs functionality beyond the schema.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=1705s">&#9201;&#65039; 28:25</a></p><div><hr></div><h2>How can developers test Siri behavior when the same voice request produces inconsistent results?</h2><p>Use two testing layers. First, App Intents Testing verifies deterministic behavior such as performing an action, querying entities, and Spotlight indexing; it can run in CI. Then use Siri Evaluations for model-dependent behavior, running varied scenarios repeatedly to measure reliability rather than expecting a single pass/fail result. The panel also mentioned using Instruments to examine end-to-end latency and tool-call round trips.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=1797s">&#9201;&#65039; 29:57</a></p><div><hr></div><h2>Can an existing App Intent adopt Tool Intent while still supporting older OS versions?</h2><p>Yes. The panel confirmed that a protocol conformance can be added rather than relying only on the macro. They also mentioned expanding the macro in Xcode to inspect its generated code and using availability conditions where appropriate.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=1974s">&#9201;&#65039; 32:54</a></p><div><hr></div><h2>What makes an App Intents integration especially effective?</h2><p>The panel mentioned the Notes app in the new beta, where a skill coordinates text editing, and emphasized integrations that remove friction in real situations, such as retrieving travel information when someone&#8217;s hands are occupied. They also noted that system apps use the same APIs available to third-party developers.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=2009s">&#9201;&#65039; 33:29</a></p><div><hr></div><h2>How can Foundation Models handle requests larger than the on-device context window?</h2><p>The speakers said the on-device context window had increased from 4K to 8K on most devices and cited a documented 32K context for Private Cloud Compute. For larger requirements, they suggested custom models through Core AI while continuing to use Foundation Models APIs. Gemma 4 was given as an example, with available context depending on model variant and hardware.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=2173s">&#9201;&#65039; 36:13</a></p><div><hr></div><h2>How can developers improve their app&#8217;s selection when Siri has multiple possible intents?</h2><p>The panel referred back to schema routing and interaction history. Donating interactions performed inside the app gives Siri evidence of how the user actually uses it. That can influence future routing, but does not guarantee selection.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=2255s">&#9201;&#65039; 37:35</a></p><div><hr></div><h2>How can Siri recover when a Tool Intent fails or cannot complete a request?</h2><p>With Tool Intents, the model may retry or look for another way to succeed after an error. Developers can provide useful error text and alternatives; an error conforming to CustomLocalizedStringResourceConvertible can supply a user-visible message. Skills can coordinate multi-tool recovery workflows, but the speakers advised improving tool design and descriptions before adding a skill solely to compensate for poorly defined tools.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=2347s">&#9201;&#65039; 39:07</a></p><div><hr></div><h2>How can developers see which tools Siri knows about when it says an app does not support a request?</h2><p>The panel did not know of a direct developer-facing dump of the tools Siri considered. They recommended Siri Integration Advisor, directly prompting for a particular tool during local testing, and adding useful synonyms to intent descriptions. Developers can also inspect extracted App Intents metadata in the built app bundle to check whether tools were included and have the expected availability.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=2478s">&#9201;&#65039; 41:18</a></p><div><hr></div><h2>How should migrated SiriKit intents be deprecated or hidden on newer OS versions?</h2><p>The panel mentioned a deprecated-intent protocol for custom migrated intents, which can hide them from Shortcuts search and show deprecation messaging for existing shortcuts. They were uncertain about the exact availability strategy for the full scenario and suggested posting the details to the developer forums.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=2617s">&#9201;&#65039; 43:37</a></p><div><hr></div><h2>What are internal-visibility entity properties for?</h2><p>They can carry information between actions or skills without exposing that data for users to select in Shortcuts or for Siri to discover. Widget configuration and interactivity were also mentioned as use cases. The panel distinguished internal entity properties from intent parameters, for which they did not identify an equivalent public mechanism.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=2713s">&#9201;&#65039; 45:13</a></p><div><hr></div><h2>How should Siri interactions be tested across languages and accents?</h2><p>The panel suggested writing Siri Evaluation scenarios in different languages and with regional phrasing. They described language models as generally multilingual, while accent-recognition failures may be speech-recognition issues outside the app&#8217;s control and worth reporting through Feedback Assistant. They did not offer a definitive accent-testing workflow.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=2815s">&#9201;&#65039; 46:55</a></p><div><hr></div><h2>Can apps dynamically create skills or tools based on user customization?</h2><p>No. In the discussed preview, tools and skills must be included at build time, in part for safety and security reasons. Developers can still support dynamic behavior by accepting entities and retrieving indexed content at runtime.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=2906s">&#9201;&#65039; 48:26</a></p><div><hr></div><h2>Should Tool Intent titles, descriptions, and entity metadata be localized?</h2><p>Siri reads available localized metadata according to the device language. The panel recommended localizing intent titles and descriptions because matching the language of the user&#8217;s request can help tool selection. Shortcuts also displays some of that text directly to users, giving another reason to localize.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=2957s">&#9201;&#65039; 49:17</a></p><div><hr></div><h2>Can existing App Intents on older OS versions also become Tool Intents?</h2><p>Yes. The panel referred back to the earlier compatibility answer: existing intents can adopt the new behavior while retaining older OS support, using the appropriate conformance and availability approach.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=3093s">&#9201;&#65039; 51:33</a></p><div><hr></div><h2>How does Siri fill multiple Tool Intent parameters, and is there an opt-in?</h2><p>There is no separate opt-in beyond adopting Tool Intent. Unlike the older App Shortcuts behavior described in the session, Siri can populate multiple parameters and generate values such as strings. Very large numbers of required parameters may reduce reliability; Siri Integration Advisor can flag those designs. Repeated parameter groups can be collected into a generable entity.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=3113s">&#9201;&#65039; 51:53</a></p><div><hr></div><h2>Can developers define synonyms for app names that Siri struggles to recognize?</h2><p>Not for Tool Intents in the iOS 27.3 preview. The panel suggested filing a feature request.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=3232s">&#9201;&#65039; 53:52</a></p><div><hr></div><h2>Can Siri understand custom non-schema entities through on-screen awareness?</h2><p>Yes, according to the panel, the new preview removes the earlier schema restriction for indexed entities. Tool calling is not required just to make the entity understandable on screen. Rebuild with the new SDK and test on the beta through Xcode or internal TestFlight.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=3263s">&#9201;&#65039; 54:23</a></p><div><hr></div><h2>How many Tool Intents can an app include, and how are they used?</h2><p>The panel believed the current shipping limit was 40 Tool Intents. Siri may chain multiple intents to complete a request. The speakers recommended prioritizing a small set of clear capabilities, then iterating with Siri Evaluations: overlapping or vague tools can confuse selection, and many tool calls can add latency.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=3314s">&#9201;&#65039; 55:14</a></p><div><hr></div><h2>How can developers tell users which Siri capabilities their app supports?</h2><p>The panel suggested onboarding that introduces example phrases. In the new preview, users can also ask Siri what a particular app can do. They acknowledged discoverability as an ongoing challenge for voice interfaces.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=3451s">&#9201;&#65039; 57:31</a></p><div><hr></div><h2>Can Core AI models be precompiled for target hardware to avoid long on-device compilation?</h2><p>Yes. The panel pointed to ahead-of-time compilation introduced with the 27.0 release, allowing models to be specialized for hardware before reaching the device. They referred developers to Core AI documentation and a WWDC session for details.</p><p><a href="https://www.youtube.com/watch?v=OnoWz-YKzzw&amp;t=3531s">&#9201;&#65039; 58:51</a></p><div><hr></div><h2>&#127942; Acknowledgments</h2><p>Thanks to <strong>Ernie, Louie, Karina, Roman, Leslie, and Michael</strong>, along with the team working behind the scenes, for the session and the answers. And thanks to everyone who submitted questions.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[Boost Your App’s Speed and Efficiency 29/10/26 - Q&A]]></title><description><![CDATA[Direct answers from Apple Engineers]]></description><link>https://antongubarenko.substack.com/p/boost-your-apps-speed-and-efficiency</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/boost-your-apps-speed-and-efficiency</guid><dc:creator><![CDATA[Anton Gubarenko]]></dc:creator><pubDate>Tue, 03 Nov 2026 04:14:00 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/675b0a7b-45fb-4c8e-979b-ca3a3f0c226f_1254x1254.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Performance is one of those areas where a small improvement can make a big difference to how an app feels. Apple&#8217;s latest Meet with Apple event brought together sessions on performance measurement, power efficiency, Instruments, MetricKit, and using coding agents to investigate real issues.</p><p>The event also included a live Q&amp;A with engineers working on performance tools, power, and UI frameworks. The questions ranged from SwiftUI specialist skills and agent workflows to GPU debugging, performance testing, business metrics, and third-party SDKs.</p><blockquote><p>I&#8217;ve formatted the Q&amp;A portion of the event, which begins after the presentations, into questions and answers that are easier to scan and revisit. The wording is cleaned up for readability while keeping the substance and uncertainty of the original responses. Each question links to its place in the video.</p></blockquote><p>Enjoy!</p><div><hr></div><h2>Why did the SwiftUI team create the SwiftUI specialist skill?</h2><p>The goal is to give developers guidance similar to having a UI framework engineer alongside them while writing or reviewing code. It includes current best practices and newer API details that may not be in a model&#8217;s training data. The examples included iOS 27&#8217;s change to the State macro and guidance for compiler errors. The skill also captures detailed advice that might otherwise come up in a one-on-one lab. The speakers encouraged developers to export and read the skill, including the explanations behind its recommendations.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=12808s">&#9201;&#65039; 3:33:28</a></p><div><hr></div><h2>Should the SwiftUI specialist skill activate automatically, or should developers invoke it explicitly?</h2><p>It is expected to activate from relevant prompts, such as requests to review SwiftUI code, apply best practices, or write modern SwiftUI. Developers can also invoke it directly. Some models may not activate it when expected, so checking the agent&#8217;s skill activation and explicitly asking it to use the skill can help.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=12944s">&#9201;&#65039; 3:35:44</a></p><div><hr></div><h2>Can Apple tools connect app performance improvements to revenue, retention, or other business outcomes?</h2><p>App Store Connect provides business metrics and peer group benchmarks, including retention and other product metrics. They are not necessarily tied directly to app versions, but changes after a release can be compared. MetricKit and State Reporting can add context about features or app states so teams can investigate how performance and usage relate to those business metrics. Xcode Organizer also provides performance recommendations based on historical and comparable-app data.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=13023s">&#9201;&#65039; 3:37:03</a></p><div><hr></div><h2>How should MetricKit and State Reporting be used alongside business metrics?</h2><p>MetricKit data can be examined by feature or app state using State Reporting, then compared with product metrics from App Store Connect. This can help investigate whether a new feature or release changed usage and performance. Xcode Organizer also compares an app&#8217;s performance against similar apps and suggests goals.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=13178s">&#9201;&#65039; 3:39:38</a></p><div><hr></div><h2>Why does Xcode Organizer recommend achievable performance goals rather than zero hangs?</h2><p>Zero hangs is difficult to achieve because an app does not control everything happening on the device, including networks, temperature, and other activity. The recommendations reflect performance achieved by comparable apps or previous versions. The goal is an experience where users do not notice disruptive performance problems, rather than an unattainable perfect metric.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=13299s">&#9201;&#65039; 3:41:39</a></p><div><hr></div><h2>Do performance tools and skills work with external coding agents, outside Xcode?</h2><p>Yes. Skills can be exported, recommendation tools are available through MCP, and xctrace is a command-line tool. The speakers said they had designed these tools to work outside Xcode. Xcode&#8217;s integrated assistant also provides conveniences such as inline comments, a readable activity transcript, and switching between model providers.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=13472s">&#9201;&#65039; 3:44:32</a></p><div><hr></div><h2>Do xctrace triage and xctrace show work for performance problems other than hangs?</h2><p>The hang example used triage, but show can be applied to other performance traces to inspect what happened. The speaker encouraged using it with other types of performance issues.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=13596s">&#9201;&#65039; 3:46:36</a></p><div><hr></div><h2>How can agents automatically test and verify performance fixes without relying on simulator measurements?</h2><p>Physical devices are important for representative performance measurements. Performance tests should exercise the expensive parts of the app under realistic conditions, including varying network conditions. Simulators can still provide directional comparisons&#8212;whether a change does more or less work&#8212;but not accurate absolute measures of power or device performance. Instruments and xctrace remain the measurement tools.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=13638s">&#9201;&#65039; 3:47:18</a></p><div><hr></div><h2>Can coding agents inspect GPU performance problems?</h2><p>Instruments offers Metal Performance Overview and Power Profiler GPU metrics. For deeper investigation, the GPU debugger provides detailed frame information. A GPU debugging command, described as new in Xcode 27, lets an agent inspect GPU debugger captures. One speaker described using a Metal frame capture from a visionOS compositor-services project with an agent.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=13838s">&#9201;&#65039; 3:50:38</a></p><div><hr></div><h2>Does xctrace triage upload performance traces to a server?</h2><p>The triage script runs locally and extracts information from a local trace. The speakers distinguished this local processing from whatever information is subsequently sent to an AI model for inference. Data retention and privacy for model inputs depend on the chosen model provider and its terms.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=13935s">&#9201;&#65039; 3:52:15</a></p><div><hr></div><h2>Does MetricKit conflict with Firebase Crashlytics or Sentry?</h2><p>No inherent conflict was described. MetricKit supplies system performance and diagnostic data, while products such as Sentry and Firebase provide additional services. MetricKit has subscribers that receive the shared data, and these services can use MetricKit as a data source. The speakers said the tools can be used together.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=14050s">&#9201;&#65039; 3:54:10</a></p><div><hr></div><h2>When are power efficiency and performance not aligned?</h2><p>They often improve together when an app does less work, but there are exceptions. A thread that spins while waiting may respond quickly while consuming more power than a messaging-based wait. On the GPU, a higher frame rate can improve perceived performance while requiring more work and energy. The tradeoff depends on the subsystem and workload.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=14201s">&#9201;&#65039; 3:56:41</a></p><div><hr></div><h2>How does using the SwiftUI specialist differ between an existing codebase and a new app?</h2><p>For an existing codebase, the agent can first help explain the architecture and decisions; the specialist can then evaluate particular choices and explain alternatives. For new code, integrating the skill from the beginning provides up-to-date best practices that may not be represented in the model&#8217;s training data. The speakers also highlighted the What&#8217;s New skill for recently introduced APIs.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=14384s">&#9201;&#65039; 3:59:44</a></p><div><hr></div><h2>What SwiftUI performance problems can the specialist skill help identify?</h2><p>Examples included frequently changing geometry placed in the environment, closures in the environment that trigger unnecessary invalidations, and broad onChange work that reads too much state. The skill can explain architectural options rather than proposing only a one-line fix. The SwiftUI instrument can identify excessive updates, which can then be investigated with the skill.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=14682s">&#9201;&#65039; 4:04:42</a></p><div><hr></div><h2>How could developers build an automated pipeline from performance diagnostics to a reviewed fix?</h2><p>Potential data sources include MetricKit, Xcode Organizer performance MCP tools, and App Store Connect APIs. An agent can analyze diagnostics in the context of source code, propose fixes, implement candidates, run before-and-after performance tests, and prepare a pull request for review. One speaker stressed requiring the agent to reproduce the original issue before accepting a fix, and then demonstrate that the reproduction no longer occurs. Such reproduction gates also help keep the agent from expanding the task to unrelated bugs.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=14840s">&#9201;&#65039; 4:07:20</a></p><div><hr></div><h2>Are there universal industry benchmarks for hangs, scrolling, crashes, and launch time?</h2><p>No universal numeric threshold was supplied. The speakers focused on whether real users perceive problems: whether an app feels smooth, whether an issue makes someone quit it, and whether a hitch is actually noticeable. They cautioned against optimizing every metric at the expense of the user experience.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=15133s">&#9201;&#65039; 4:12:13</a></p><div><hr></div><h2>Can Xcode Organizer show which part of an app causes animation hitches?</h2><p>Organizer aggregates hitches across the app and does not currently provide that breakdown. MetricKit, including State Reporting, can add app-state context to hitch measurements. The speakers suggested filing feedback for finer-grained Organizer reporting.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=15311s">&#9201;&#65039; 4:15:11</a></p><div><hr></div><h2>How do you investigate SwiftUI animation hitches?</h2><p>Use the SwiftUI instrument together with the Hitches instrument. Find a hitch on the timeline, expand its update interval, and correlate that interval with SwiftUI updates. Look for slow synchronous work in a view body or views updating too frequently. Profile on a physical device in Release configuration; Debug builds and debug printing can give misleading results because compiler optimizations differ.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=15457s">&#9201;&#65039; 4:17:37</a></p><div><hr></div><h2>Can an app override a third-party SDK that keeps the display at 120 frames per second?</h2><p>The speaker did not know of a general override. Developers may need to change how they use the SDK or ask its maintainer to fix the behavior. If the SDK requests a high frame rate, the system cannot infer the app&#8217;s intention to run more slowly.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=15667s">&#9201;&#65039; 4:21:07</a></p><div><hr></div><h2>How should developers handle third-party SDKs that hurt launch time or other performance metrics?</h2><p>Establish performance baselines and run tests when adding or updating SDKs. Launch tests can expose work such as static initializers. Some regressions only appear on first launch, after an update, or following a device restart, so those conditions matter. Collect evidence and work with the SDK provider to resolve the problem.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=15749s">&#9201;&#65039; 4:22:29</a></p><div><hr></div><h2>Are there Apple-provided coding skills for UIKit and other technologies beyond SwiftUI?</h2><p>The App Resizability skill covers UIKit as well as SwiftUI and helps apps adapt to iPhone Duo. Other skills mentioned included App Intents and a security-related skill for C bounds checking. The speakers encouraged developers to inspect available skills and submit feedback about missing guidance.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=15929s">&#9201;&#65039; 4:25:29</a></p><div><hr></div><h2>How do xctrace tools reduce token usage when agents analyze Instruments recordings?</h2><p>Instead of converting an entire trace to a large format such as XML, triage extracts a concise starting point: whether there is a meaningful issue, which interval matters, and what to inspect next. The agent can then use show for targeted detail. This avoids consuming tokens on data that is not needed.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=16040s">&#9201;&#65039; 4:27:20</a></p><div><hr></div><h2>What lesser-known performance tools or techniques did the speakers highlight?</h2><p>The updated SwiftUI instrument was one suggestion, especially for developers who have not revisited Instruments recently. Another tip concerned the compositor fast path, which can avoid work when rendering video, Metal content, and certain other material. Its indicator in the performance tools can show whether that path is active; the speaker was not certain of the exact indicator colors. Missing the fast path can mean additional power use and rendering work.</p><p><a href="https://www.youtube.com/watch?v=2juDbUA2zlA&amp;t=16191s">&#9201;&#65039; 4:29:51</a></p><div><hr></div><h2>&#127942; Acknowledgments</h2><p>Thanks to <strong>Cole, Phil, Shafali, Adan, Luca, and Steven</strong> for the discussion and answers, and to the developers who submitted questions.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[iOS 27: Now Playing Framework]]></title><description><![CDATA[Control the media playing]]></description><link>https://antongubarenko.substack.com/p/ios-27-now-playing-framework</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/ios-27-now-playing-framework</guid><dc:creator><![CDATA[Anton Gubarenko]]></dc:creator><pubDate>Tue, 27 Oct 2026 06:22:55 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/fa247d5c-2167-4c6f-b0d5-f728979b2e50_1254x1254.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Apple has always had a close relationship with music. It started with the sensational iPod, a digital music player with its iconic Click Wheel. Then came the iPod touch, which looked like an iPhone but was, first and foremost, a beautiful music player. The list goes on with AirPods and Apple Music.</p><p>Music has always been an important part of Apple&#8217;s ecosystem. And developers, of course, have always wanted APIs to bring music experiences into their own apps.</p><p>This year, Apple has taken a significant step forward by introducing a new framework to replace an approach dating back to iOS 5. Remember <code>MPNowPlayingInfoCenter</code> and <code>MPRemoteCommandCenter</code>? They&#8217;ve been handling playback metadata and remote controls for years.</p><p>Now, there&#8217;s a new way to manage all of that.</p><p>Meet the Now Playing framework in iOS 27! &#127925;</p><blockquote><p>I&#8217;ll keep naming like this since it&#8217;s the Framework name. Just sounds pretty natural.</p></blockquote><div><hr></div><h2>A Podcast Player</h2><p>To show how it works it obvious that we need a music player. Once, many decades ago I&#8217;ve been working with Podcasts and it&#8217;s a perfect moment to make a Podcast player )</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ag1A!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4aea23-3a3a-4b70-a353-caf095489b62_1206x2622.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ag1A!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4aea23-3a3a-4b70-a353-caf095489b62_1206x2622.png 424w, https://substackcdn.com/image/fetch/$s_!Ag1A!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4aea23-3a3a-4b70-a353-caf095489b62_1206x2622.png 848w, https://substackcdn.com/image/fetch/$s_!Ag1A!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4aea23-3a3a-4b70-a353-caf095489b62_1206x2622.png 1272w, https://substackcdn.com/image/fetch/$s_!Ag1A!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4aea23-3a3a-4b70-a353-caf095489b62_1206x2622.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ag1A!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4aea23-3a3a-4b70-a353-caf095489b62_1206x2622.png" width="432" height="939.223880597015" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8c4aea23-3a3a-4b70-a353-caf095489b62_1206x2622.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2622,&quot;width&quot;:1206,&quot;resizeWidth&quot;:432,&quot;bytes&quot;:130691,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/222006683?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4aea23-3a3a-4b70-a353-caf095489b62_1206x2622.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Ag1A!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4aea23-3a3a-4b70-a353-caf095489b62_1206x2622.png 424w, https://substackcdn.com/image/fetch/$s_!Ag1A!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4aea23-3a3a-4b70-a353-caf095489b62_1206x2622.png 848w, https://substackcdn.com/image/fetch/$s_!Ag1A!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4aea23-3a3a-4b70-a353-caf095489b62_1206x2622.png 1272w, https://substackcdn.com/image/fetch/$s_!Ag1A!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c4aea23-3a3a-4b70-a353-caf095489b62_1206x2622.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Our Player UI</figcaption></figure></div><p>It&#8217;s is a good example because Now Playing is not only metadata. The system also needs an accurate playback position and commands such as seeking and skipping 15 or 30 seconds.</p><p>The core model can remain the same model that owns the actual player:</p><pre><code><code>import AVFoundation
@preconcurrency import NowPlaying
import Observation

@available(iOS 27.0, *)
@MainActor
@Observable
final class PodcastPlayer: @MainActor MediaSessionRepresentable {

    //Our Media data
    struct Episode {
        let id: String
        let title: String
        let show: String
        let duration: TimeInterval
        let resourceName: String
        let resourceExtension: String
    }

    let id = "podcast-session"
    let episode: Episode

    private let player: AVPlayer
    private var session: MediaSession&lt;PodcastPlayer&gt;?
    @ObservationIgnored
    nonisolated(unsafe) private var periodicObserver: Any?
    @ObservationIgnored
    nonisolated(unsafe) private var didFinishObserver: NSObjectProtocol?

    private(set) var isPlaying = false
    private(set) var elapsedTime: TimeInterval = 0

    init(episode: Episode) {
        self.episode = episode

        guard let url = Bundle.main.url(
            forResource: episode.resourceName,
            withExtension: episode.resourceExtension
        ) else {
            fatalError("Missing bundled audio resource")
        }

        player = AVPlayer(url: url)

        periodicObserver = player.addPeriodicTimeObserver(
            forInterval: CMTime(seconds: 0.5, preferredTimescale: 600),
            queue: .main
        ) { [weak self] time in
            MainActor.assumeIsolated {
                guard let self else { return }
                let seconds = time.seconds
                if seconds.isFinite {
                    self.elapsedTime = seconds
                }
            }
        }

        didFinishObserver = NotificationCenter.default.addObserver(
            forName: .AVPlayerItemDidPlayToEndTime,
            object: player.currentItem,
            queue: .main
        ) { [weak self] _ in
            MainActor.assumeIsolated {
                self?.isPlaying = false
            }
        }
    }
}</code></code></pre><blockquote><p>I&#8217;m supporting Swift 6.2 and Strict Concurrency</p></blockquote><p>There is no separate &#8220;Now Playing state&#8221; object here. The same model that controls playback also describes it to the system.</p><div><hr></div><h2>Describing the Content</h2><p><code>MediaSessionRepresentable.content</code> replaces the dictionary-style metadata publishing most of us know from <code>MPNowPlayingInfoCenter</code>. More importantly, the framework understands what kind of media you are publishing.</p><p>For a podcast we can return <code>PodcastContent</code>:</p><pre><code><code>var content: (any MediaContentRepresentable)? {
    PodcastContent(
        id: episode.id,
        episodeTitle: episode.title,
        showName: episode.show,
        releaseDate: nil,
        type: .audio,
        duration: .finite(episode.duration),
        artwork: nil
    )
}</code></code></pre><p>Now Playing also provides dedicated content types for music, movies, TV shows, books, radio, home media, plus <code>GenericContent</code> when none of those categories fit. That is a nicer contract than a bag of loosely related metadata keys.</p><div><hr></div><h2>Playback State Is a Snapshot</h2><p>The system does not need your app to publish a new progress value every second. Instead, <code>MediaPlaybackSnapshot</code>describes the state, elapsed time, and the moment that value was captured. The system can extrapolate progress while playback continues.</p><pre><code><code>var playbackSnapshot: MediaPlaybackSnapshot? {
    MediaPlaybackSnapshot(
        state: isPlaying ? .playing() : .paused,
        defaultPlaybackRate: 1,
        elapsedTime: elapsedTime,
        timestamp: .now
    )
}</code></code></pre><p>The sample updates <code>elapsedTime</code> using an <code>AVPlayer</code> periodic time observer every 0.5 seconds, and uses <code>.now</code> as the snapshot timestamp. The observer also drives the SwiftUI slider. The sample handles the end of playback through <code>AVPlayerItemDidPlayToEndTime</code>.</p><p>Once this data is provided, on Locked Screen or Command Center you will see the video info and enabled controls:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NE25!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a99fb62-72a7-40bd-b23b-d758d956d5b6_492x494.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NE25!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a99fb62-72a7-40bd-b23b-d758d956d5b6_492x494.jpeg 424w, https://substackcdn.com/image/fetch/$s_!NE25!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a99fb62-72a7-40bd-b23b-d758d956d5b6_492x494.jpeg 848w, https://substackcdn.com/image/fetch/$s_!NE25!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a99fb62-72a7-40bd-b23b-d758d956d5b6_492x494.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!NE25!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a99fb62-72a7-40bd-b23b-d758d956d5b6_492x494.jpeg 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!NE25!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a99fb62-72a7-40bd-b23b-d758d956d5b6_492x494.jpeg" width="322" height="323.3089430894309" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7a99fb62-72a7-40bd-b23b-d758d956d5b6_492x494.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:494,&quot;width&quot;:492,&quot;resizeWidth&quot;:322,&quot;bytes&quot;:35379,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/222006683?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a99fb62-72a7-40bd-b23b-d758d956d5b6_492x494.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NE25!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a99fb62-72a7-40bd-b23b-d758d956d5b6_492x494.jpeg 424w, https://substackcdn.com/image/fetch/$s_!NE25!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a99fb62-72a7-40bd-b23b-d758d956d5b6_492x494.jpeg 848w, https://substackcdn.com/image/fetch/$s_!NE25!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a99fb62-72a7-40bd-b23b-d758d956d5b6_492x494.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!NE25!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a99fb62-72a7-40bd-b23b-d758d956d5b6_492x494.jpeg 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Control Center widget</figcaption></figure></div><div><hr></div><h2>Commands Live Next to the State</h2><p>Commands are also part of the representation:</p><pre><code><code>var commands: [MediaCommand] {
    [
        .play { self.play() },
        .pause { self.pause() },
        .skipBackward(preferredIntervals: [15]) { interval in
            self.skip(by: -interval)
        },
        .skipForward(preferredIntervals: [30]) { interval in
            self.skip(by: interval)
        },
        .seekToPosition { position in
            self.seek(to: position)
        }
    ]
}</code></code></pre><p>Each command is a closure the system invokes when someone interacts with Now Playing on the Lock Screen, Control Center, CarPlay, or another supported surface. The list is also dynamic: <code>enabled(_:)</code> can make commands unavailable as your playback state changes.</p><p>The playback methods use the observed elapsed time and clamp seeks to the episode duration:</p><pre><code><code>func play() {
    if elapsedTime &gt;= episode.duration {
        seek(to: 0)
    }
    player.play()
    isPlaying = true
}

func pause() {
    player.pause()
    isPlaying = false
}

func seek(to position: TimeInterval) {
    let clamped = min(max(position, 0), episode.duration)
    elapsedTime = clamped
    player.seek(
        to: CMTime(seconds: clamped, preferredTimescale: 600)
    )
}

func skip(by interval: TimeInterval) {
    seek(to: elapsedTime + interval)
}</code></code></pre><p>This is the part I like most about the API. Remote controls are no longer a second command system that has to be wired to the player separately. They are capabilities declared by the same observable representation.</p><div><hr></div><h2>Publishing the Session</h2><p>Conforming to <code>MediaSessionRepresentable</code> is not enough. Create a <code>MediaSession</code> and make it the application&#8217;s primary session:</p><pre><code><code>func activate() async throws {
    let audioSession = AVAudioSession.sharedInstance()
    try audioSession.setCategory(.playback, mode: .default)
    try audioSession.setActive(true)

    let mediaSession = MediaSession(self)
    session = mediaSession
    try await mediaSession.requestToBecomeApplicationPrimary()
}

func deactivate() {
    pause()
    session = nil
    try? AVAudioSession.sharedInstance().setActive(
        false,
        options: .notifyOthersOnDeactivation
    )
}</code></code></pre><p>An app can own multiple media sessions&#8212;for example, separate music and podcast players&#8212;but only one is application-primary at a time. There is also <code>requestToBecomeSystemPrimary()</code>, which asks to make the session the active system session and must be called while the app is in the foreground.</p><p>When playback is finished, releasing the <code>MediaSession</code> removes it from the system.</p><div><hr></div><h2>Don&#8217;t Mix the Old and New APIs</h2><p>This migration detail deserves its own section. Apple explicitly warns against using the new local Now Playing sessions together with <code>MPNowPlayingInfoCenter</code> or <code>MPRemoteCommandCenter</code>. The result is undefined behavior.</p><p>So this should be treated as a replacement boundary, not an incremental layer where you publish half of the state through Media Player and half through Now Playing.</p><p>For an existing app, I would keep the actual playback engine untouched and replace the system-integration layer around it.</p><div><hr></div><h2>Remote Playback Is the Bigger Addition</h2><p>Local sessions are a much cleaner version of a problem iOS apps could already solve. Remote sessions are more interesting.</p><p>A <code>RemoteMediaSessionRepresentable</code> can describe media that is actually playing on an external speaker, streaming stick, or TV. The integration lives in an app extension, and the remote state can be updated through push notifications even when the main app is not running. Commands from the system UI are routed back through that extension to your service or device.</p><p>That means a third-party smart speaker can have its playback represented on the iPhone Lock Screen and Control Center without pretending that the audio is playing locally.</p><p>For apps that only play audio on the iPhone, you can ignore this entire side of the framework. For apps controlling external playback hardware, it is probably the most important part of Now Playing.</p><div><hr></div><h2>One Model, Multiple System Surfaces</h2><p>The real improvement is not fewer lines of code. It is ownership.</p><p>With the old approach, the app pushed metadata into one API, registered command handlers in another, and kept both synchronized with the actual player. Now Playing makes the player representation observable and lets the system consume it.</p><p>Change the episode and <code>content</code> changes. Pause playback and <code>playbackSnapshot</code> changes. Reach the end of a queue and a command can become disabled. The system follows the model instead of requiring another manually maintained copy of it.</p><p>For media apps, that is a much better direction.</p><div><hr></div><h2>Complete Project</h2><p>The complete SwiftUI podcast player is available as a public Gist: <a href="https://gist.github.com/lanserxt/c3dcba6a500aedcc2f8139dc35dfbb41">PodcastDemoApp.swift &#8212; Complete Project</a>.</p><p>The sample uses iOS 27 availability annotations, main-actor conformance, playback time and completion observers, and a bundled 55-second audio track. Add <code>sample-55s.mp3</code> below (or any file you like) to the app target&#8217;s resources.</p><div class="native-audio-embed" data-component-name="AudioPlaceholder" data-attrs="{&quot;label&quot;:null,&quot;mediaUploadId&quot;:&quot;d1e84dfb-27f5-4f78-8458-16215d6538cc&quot;,&quot;duration&quot;:54.987755,&quot;downloadable&quot;:true,&quot;isEditorNode&quot;:true}"></div><p><strong>To keep audio playing while the app is in the background or the device is locked, enable Background Modes &#8594; Audio, AirPlay, and Picture in Picture in Xcode under Signing &amp; Capabilities.</strong> This enables <code>UIBackgroundModes</code>with the <code>audio</code> value. Configuring <code>AVAudioSession</code> with <code>.playback</code> alone does not enable background audio.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4rpK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F959bb4f8-5c14-40df-9d90-2da6cdb9272e_1416x624.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4rpK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F959bb4f8-5c14-40df-9d90-2da6cdb9272e_1416x624.png 424w, https://substackcdn.com/image/fetch/$s_!4rpK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F959bb4f8-5c14-40df-9d90-2da6cdb9272e_1416x624.png 848w, https://substackcdn.com/image/fetch/$s_!4rpK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F959bb4f8-5c14-40df-9d90-2da6cdb9272e_1416x624.png 1272w, https://substackcdn.com/image/fetch/$s_!4rpK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F959bb4f8-5c14-40df-9d90-2da6cdb9272e_1416x624.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!4rpK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F959bb4f8-5c14-40df-9d90-2da6cdb9272e_1416x624.png" width="1416" height="624" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/959bb4f8-5c14-40df-9d90-2da6cdb9272e_1416x624.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:624,&quot;width&quot;:1416,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:265654,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/222006683?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F959bb4f8-5c14-40df-9d90-2da6cdb9272e_1416x624.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4rpK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F959bb4f8-5c14-40df-9d90-2da6cdb9272e_1416x624.png 424w, https://substackcdn.com/image/fetch/$s_!4rpK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F959bb4f8-5c14-40df-9d90-2da6cdb9272e_1416x624.png 848w, https://substackcdn.com/image/fetch/$s_!4rpK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F959bb4f8-5c14-40df-9d90-2da6cdb9272e_1416x624.png 1272w, https://substackcdn.com/image/fetch/$s_!4rpK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F959bb4f8-5c14-40df-9d90-2da6cdb9272e_1416x624.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Xcode Background Modes</figcaption></figure></div><p>Happy coding!</p><div><hr></div><h2>References</h2><ul><li><p>Apple Developer Documentation: <a href="https://developer.apple.com/documentation/NowPlaying">Now Playing</a></p></li><li><p>Apple Developer Documentation: <a href="https://developer.apple.com/documentation/NowPlaying/publishing-media-sessions">Publishing media sessions</a></p></li><li><p>Apple Developer Documentation: <a href="https://developer.apple.com/documentation/NowPlaying/MediaSessionRepresentable">MediaSessionRepresentable</a></p></li><li><p>Apple Developer Documentation: <a href="https://developer.apple.com/documentation/NowPlaying/MediaSession">MediaSession</a></p></li><li><p>Apple Developer Documentation: <a href="https://developer.apple.com/documentation/NowPlaying/publishing-remote-media-sessions">Publishing remote media sessions</a></p></li><li><p>WWDC26: <a href="https://developer.apple.com/videos/play/wwdc2026/312/">Meet the Now Playing framework</a></p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Swift Bits: Test In-App Purchases in Any Region]]></title><description><![CDATA[Use Sandbox Apple Accounts to test regional pricing and subscriptions]]></description><link>https://antongubarenko.substack.com/p/swift-bits-test-in-app-purchases</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/swift-bits-test-in-app-purchases</guid><pubDate>Wed, 21 Oct 2026 06:02:26 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/a7b4cb85-9b88-4998-8113-3f7b1d637bf6_1024x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Ever needed to test In-App Purchases for the US App Store while sitting somewhere in Europe? &#127757;</p><p>Changing your personal Apple Account region isn&#8217;t the answer. Change store is always takes time, subscriptions cancellation etc&#8230; And you definitely don&#8217;t need to travel just to verify regional pricing or subscriptions!</p><p><strong>Sandbox Apple Accounts</strong> let you test StoreKit purchases using different App Store StoreFronts, without real payments or changing your personal account.</p><p>You can create a Sandbox Tester in App Store Connect, choose the country you want to test, and sign in on your development device.</p><p>This is especially useful for <strong>QA engineers and iOS developers</strong> working with subscriptions, localized prices, and region-specific purchase flows. Or, when you are limited to specific distribution market also.</p><p>I&#8217;ve put together a quick guide showing how to configure a Sandbox Apple Account and test purchases across different regions.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wh3U!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb524b0d0-a8f2-426b-b60d-601fbb686fcb_1800x3092.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wh3U!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb524b0d0-a8f2-426b-b60d-601fbb686fcb_1800x3092.png 424w, https://substackcdn.com/image/fetch/$s_!wh3U!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb524b0d0-a8f2-426b-b60d-601fbb686fcb_1800x3092.png 848w, https://substackcdn.com/image/fetch/$s_!wh3U!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb524b0d0-a8f2-426b-b60d-601fbb686fcb_1800x3092.png 1272w, https://substackcdn.com/image/fetch/$s_!wh3U!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb524b0d0-a8f2-426b-b60d-601fbb686fcb_1800x3092.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wh3U!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb524b0d0-a8f2-426b-b60d-601fbb686fcb_1800x3092.png" width="1456" height="2501" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b524b0d0-a8f2-426b-b60d-601fbb686fcb_1800x3092.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2501,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:405291,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/221314809?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb524b0d0-a8f2-426b-b60d-601fbb686fcb_1800x3092.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wh3U!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb524b0d0-a8f2-426b-b60d-601fbb686fcb_1800x3092.png 424w, https://substackcdn.com/image/fetch/$s_!wh3U!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb524b0d0-a8f2-426b-b60d-601fbb686fcb_1800x3092.png 848w, https://substackcdn.com/image/fetch/$s_!wh3U!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb524b0d0-a8f2-426b-b60d-601fbb686fcb_1800x3092.png 1272w, https://substackcdn.com/image/fetch/$s_!wh3U!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb524b0d0-a8f2-426b-b60d-601fbb686fcb_1800x3092.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>References</h2><ul><li><p><a href="https://developer.apple.com/help/app-store-connect/test-in-app-purchases/create-a-sandbox-apple-account/">Create a Sandbox Apple Account</a></p></li><li><p><a href="https://developer.apple.com/help/app-store-connect/test-in-app-purchases/manage-sandbox-apple-account-settings/">Manage Sandbox Apple Account Settings</a></p></li><li><p><a href="https://developer.apple.com/documentation/storekit/testing-in-app-purchases-with-sandbox">Testing In-App Purchases with Sandbox</a></p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[iPhone Duo Group Lab 10/15/26 - Q&A]]></title><description><![CDATA[Direct answers from Apple Engineers]]></description><link>https://antongubarenko.substack.com/p/iphone-duo-group-lab-101526-q-and</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/iphone-duo-group-lab-101526-q-and</guid><dc:creator><![CDATA[Anton Gubarenko]]></dc:creator><pubDate>Fri, 16 Oct 2026 13:20:32 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/258c14d9-09d4-4384-a043-479dacbb4860_960x639.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Another iPhone Duo Group Lab and another round of practical questions from developers getting their apps ready for the new form factor.</p><p>This session goes deep into navigation choices, vertical bars, right-to-left layouts, preserving scroll position, orientation, Arrangement Views, reserved regions, and how much an app should really change between Duo poses.</p><p>As with the previous Q&amp;A, I went through the session and put the questions and answers into a format that&#8217;s easier to scan, revisit, and use while working on an app.</p><blockquote><p>I tried to preserve the original wording and combine related answers where appropriate. However, some inaccuracies or mismatches are still possible.</p></blockquote><p>Enjoy!</p><div><hr></div><h2>What&#8217;s one thing developers should adopt to make the best experience for their app on iPhone Duo?</h2><p>Build a good iPhone and iPad app that handles arbitrary sizes, respects size classes, and follows platform conventions.</p><p>Pay attention to layout margins and safe-area insets, including the side safe areas. Duo can provide asymmetric left and right safe-area insets and layout margins.</p><p>Use standard system components where possible. Navigation bars, toolbars, and tab bars can move controls to the vertical axis automatically and can also adapt when an app is placed on the other side in split view multitasking.</p><p>For more customized layouts, the APIs discussed form a progression: standard components, Arrangement Views, reserved regions, and lower-level hinge APIs.</p><p><a href="https://www.youtube.com/watch?v=kmf3gkQMex4&amp;t=262s">&#9201;&#65039; 4:22</a></p><div><hr></div><h2>Should an iPhone app use both TabView and NavigationSplitView on iPhone Duo, or switch to a sidebar?</h2><p>Using both is not inherently wrong. The choice depends on the app.</p><p>Music, TV, and Podcasts use a vertical tab bar on Duo even though they can use split views on iPad. Mail carries its split-view structure over to Duo.</p><p>A split view can work well when the app has a deep hierarchy or content list, while tabs can work well when they represent a smaller number of major sections and the content itself is the focus.</p><p>Phone was given as an example where a split view exists inside a tab view on the inner display.</p><p>Continuity between the outer and inner display also matters. The open layout should still have a recognizable relationship to the closed layout.</p><p>The discussion also mentioned the sidebar-adaptable TabView style, used when showing more of the hierarchy is worth changing the navigation presentation.</p><p><a href="https://www.youtube.com/watch?v=kmf3gkQMex4&amp;t=659s">&#9201;&#65039; 10:59</a></p><div><hr></div><h2>How can a widget detect that it is being displayed in StandBy?</h2><p>No definite API answer was given.</p><p>The speakers suggested looking at WidgetKit environment values and mentioned that the rendering environment differs in StandBy, but they did not confirm the exact API.</p><p>Live Activities were given as a related example: they can detect a constrained horizontal environment.</p><p>The extra-large widget size was also mentioned as useful on iPhone Duo.</p><p><a href="https://www.youtube.com/watch?v=kmf3gkQMex4&amp;t=1176s">&#9201;&#65039; 19:36</a></p><div><hr></div><h2>Can the launch screen change the status-bar axis when the app disables the vertical bar?</h2><p>No specific Info.plist configuration was identified.</p><p>The answer was that there probably is not one, and this was suggested as feedback to file.</p><p>The discussion also noted that most apps should keep the vertical bar because users will expect controls and navigation there. Apps such as Calculator or immersive games may have specific reasons to disable it.</p><p><a href="https://www.youtube.com/watch?v=kmf3gkQMex4&amp;t=1286s">&#9201;&#65039; 21:26</a></p><div><hr></div><h2>Should a custom hamburger menu on the left move to the right on iPhone Duo?</h2><p>For the menu itself, continuity suggests keeping a left-side navigation hierarchy on the left when moving between open and closed states.</p><p>For navigation controls such as a back button, users will expect them in the vertical bar on the right.</p><p>If the app has its own overflow or hamburger menu, also consider the system vertical bar&#8217;s overflow behavior. Custom items can be placed in the system overflow rather than creating two competing overflow menus.</p><p><a href="https://www.youtube.com/watch?v=kmf3gkQMex4&amp;t=1374s">&#9201;&#65039; 22:54</a></p><div><hr></div><h2>How should right-to-left languages work with Duo&#8217;s vertical bars and split views?</h2><p>The vertical bar does not simply flip to the left for a right-to-left language. Its placement is tied to factors including the hardware, status bar, display shape, and camera.</p><p>System APIs handle this automatically. For a custom vertical bar, an environment value can indicate which side should be used.</p><p>Other UI still follows right-to-left layout behavior. For example, a split view&#8217;s leading column can move to the right while the vertical bar remains on the right. The controls in that vertical bar still come from the content column.</p><p>In split view multitasking, bars can also move to the left side of the display depending on where the app is placed.</p><p><a href="https://www.youtube.com/watch?v=kmf3gkQMex4&amp;t=1665s">&#9201;&#65039; 27:45</a></p><div><hr></div><h2>Can developers see the standard Camera app interface to understand its open and closed layouts?</h2><p>Not during this session.</p><p>The speakers could not show the Camera app in that moment. They also confirmed that the capture view controller could not be opened in the simulator for this purpose.</p><p><a href="https://www.youtube.com/watch?v=kmf3gkQMex4&amp;t=1929s">&#9201;&#65039; 32:09</a></p><div><hr></div><h2>How should an app preserve collection-view or reading position when moving between the outer and inner displays?</h2><p>Opening Duo does not create a new app or scene. The same scene and UI instances adapt to the larger size.</p><p>In News, the collection view preserves the visible item/index path across the transition. For article text, News creates a text anchor before the transition and restores that semantic text position afterward.</p><p>Do not rely only on a Y offset because the content geometry changes when the width changes.</p><p>For a collection or grid that does not preserve the expected visible item, the speakers suggested filing feedback with a small sample project.</p><p><a href="https://www.youtube.com/watch?v=kmf3gkQMex4&amp;t=1974s">&#9201;&#65039; 32:54</a></p><div><hr></div><h2>Is there a timeline for Apple Pencil support on iPhone Duo?</h2><p>No timeline was given.</p><p>The speakers said they could not discuss future timelines or milestones.</p><p><a href="https://www.youtube.com/watch?v=kmf3gkQMex4&amp;t=2283s">&#9201;&#65039; 38:03</a></p><div><hr></div><h2>How should apps handle orientation on the inner display when orientation locks are ignored?</h2><p>For most apps, think in terms of available size rather than treating portrait and landscape as separate modes.</p><p>Use size classes, traits, environment values, and the available space on each axis.</p><p>On the inner display, controls that are on the right edge in landscape move back toward the top and bottom in portrait.</p><p>Arrangement Views can also express semantic relationships between content: side-by-side in one configuration, above and below in another, or stacked where appropriate.</p><p><a href="https://www.youtube.com/watch?v=kmf3gkQMex4&amp;t=2315s">&#9201;&#65039; 38:35</a></p><div><hr></div><h2>When should content move away from the fold, and when can it remain under it?</h2><p>Consider the scrolling direction relative to the hinge.</p><p>Messages moves bubbles away from the hinge because the bubbles scroll along the same axis as the fold; scrolling would not naturally move obscured content away.</p><p>Preview changes a PDF to a horizontal two-page layout in a book-like pose, allowing content to scroll across the hinge and out of the way.</p><p>Safari and list-style interfaces can leave content across the fold when scrolling naturally moves it away.</p><p>For fixed controls, move them out of the reserved region with as little layout movement as possible. The goal described was not to radically reflow the interface for every pose.</p><p>The App Store Today view was given as an example where a vertical grid shifts its columns away from the fold, while horizontally scrolling carousels in apps such as Music, Podcasts, and TV can pass through it.</p><p><a href="https://www.youtube.com/watch?v=kmf3gkQMex4&amp;t=2782s">&#9201;&#65039; 46:22</a></p><div><hr></div><h2>For independent developers or small teams, how should they find genuinely valuable Duo use cases instead of adding features just to use the extra space?</h2><p>Start by making the existing app work well on the device.</p><p>Using standard components reduces the work spent recreating system behavior and leaves more time for the parts that make the app unique.</p><p>For an iPhone-only app, the same ideas used when bringing an app to iPad can help: the larger space can expose more of an existing hierarchy at once through split views, multiple columns, or Arrangement Views.</p><p>The speakers also suggested avoiding features that only work in one specific pose unless there is a physical reason for that restriction. People will move Duo between poses frequently, so maintaining a sense of place matters.</p><p>For sheet-based apps, a new SwiftUI sheet presentation placement API was mentioned for moving a bottom sheet to a leading or trailing side in a larger layout.</p><p><a href="https://www.youtube.com/watch?v=kmf3gkQMex4&amp;t=3082s">&#9201;&#65039; 51:22</a></p><div><hr></div><h2>What was the biggest design or technical challenge when adapting system apps for iPhone Duo?</h2><p>Several examples were given.</p><p>For Measure, the Level feature had to account for many more physical poses where the device no longer has one fixed orientation.</p><p>From the workshops, developers often initially wanted a different design for every pose. The challenge was moving from that experimentation toward a stable experience that works as people naturally move the device.</p><p>Another challenge was balancing novelty against changes that actually add value, along with adapting layouts around unavailable rectangular areas such as the camera and status-bar regions.</p><p>For News, Stocks, and Weather, standard navigation components handled much of the vertical-bar adaptation automatically, while safe areas, camera regions, corner adaptation, and reserved regions still required attention.</p><p>Search was another example: it remains at the bottom on Duo as part of the continuity with iPhone, even though an iPad presentation may place it elsewhere.</p><p><a href="https://www.youtube.com/watch?v=kmf3gkQMex4&amp;t=3519s">&#9201;&#65039; 58:39</a></p><div><hr></div><h2>&#127942; Acknowledgments</h2><p>A huge thank-you to <strong>Muhammad, Kurt, Grant, Henry, and Russell</strong> for answering the questions during the lab.</p><p>Thanks as well to everyone who submitted questions about iPhone Duo navigation, widgets, vertical bars, right-to-left layouts, scrolling, orientation, Arrangement Views, reserved regions, and adaptive UI.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[iPhone Duo Group Lab 10/13/26 - Q&A]]></title><description><![CDATA[Direct answers from Apple Engineers]]></description><link>https://antongubarenko.substack.com/p/iphone-duo-group-lab-101326-q-and</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/iphone-duo-group-lab-101326-q-and</guid><dc:creator><![CDATA[Anton Gubarenko]]></dc:creator><pubDate>Thu, 15 Oct 2026 07:41:01 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/511056a4-97e8-4e9e-a35a-170f41dbed70_960x639.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Apple keeps the iPhone Duo conversation going and so do I.</p><p>This is another Group Lab packed with practical questions about building for Duo: adaptive layouts, different poses, Arrangement Views, camera behavior, testing, navigation, games, StandBy, Picture in Picture, and custom bars.</p><p>As with the previous Q&amp;A, I went through the session and put the questions and answers into a format that&#8217;s easier to scan, revisit, and use while working on an app.</p><blockquote><p>I tried to preserve the original wording and combine related answers where appropriate. However, some inaccuracies or mismatches are still possible.</p></blockquote><p>Enjoy!</p><div><hr></div><h2>How should developers design an app that feels native across different iPhone Duo poses?</h2><p>Think of it as one iPhone app that appears in different poses and layouts. Keep the controls, hierarchy, and navigation consistent so people know where things are as they move between poses.</p><p>iPhone Duo can be held, placed down, and propped up in more orientations than other iPhones, so the same app may be used in more states.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=268s">&#9201;&#65039; 4:28</a></p><div><hr></div><h2>When moving a custom view away from the partial-fold division region, which side should it move to?</h2><p>For many controls, moving toward the right can work because of how people commonly hold the device. Smaller elements such as context menus can stay on the same side as their source view so they preserve continuity.</p><p>The hierarchy of the app can also determine the direction. In a primary/detail layout, elements may already have a natural side.</p><p>In seated mode, interactive controls can be kept toward the bottom, where there is a stable surface to press against.</p><p>For primary/detail layouts, the detail is often also the content that remains visible when the device closes.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=401s">&#9201;&#65039; 6:41</a></p><div><hr></div><h2>Should a custom two-pane split using GeometryReader move to Arrangement View?</h2><p>A split Arrangement View can replace some uses of GeometryReader. Its column ratio can be customized, and it works on Duo as well as other iPhones.</p><p>If GeometryReader is reporting an unexpected size after rotation, that is worth filing as feedback.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=602s">&#9201;&#65039; 10:02</a></p><div><hr></div><h2>Do we need a physical iPhone Duo for testing, or is the simulator enough?</h2><p>A physical Duo is not required for most testing. The simulator can test the app across the different states and poses.</p><p>Hardware-specific features, including some camera behavior, may be better tested on a physical device. A physical Duo can also change design decisions once you feel how control placement and layouts work in your hands.</p><p>For most app behavior, the simulator provides a good view of how the app works across orientations and layouts.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=711s">&#9201;&#65039; 11:51</a></p><div><hr></div><h2>Can Live Activities and widgets use the new StandBy experience on iPhone Duo?</h2><p>Widget sizes already supported in StandBy also work on Duo. There is also an extra-large widget format that can fill roughly half of the open Duo display.</p><p>In the book configuration, one side can show time, date, and calendar while the other side shows a Live Activity such as music or flight information.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=924s">&#9201;&#65039; 15:24</a></p><div><hr></div><h2>For camera apps, is opening and closing Duo mainly a camera-direction change or an adaptive-layout transition?</h2><p>It can be both.</p><p>For a photography app using a rear-facing camera, opening the device can keep the same camera and provide more screen space. For a front-facing camera experience such as video calling, opening the device can switch from the outer-display camera to the inner camera.</p><p>Camera apps should use <strong>AVCaptureDeviceRotationCoordinator</strong> and <strong>AVCaptureDeviceDirectionCoordinator</strong>.</p><p>When Duo is open, the rear camera is still portrait-oriented while the screen is landscape-oriented. A photography app may show the full sensor preview with framing around it, while an AR experience may zoom the camera preview edge-to-edge.</p><p>The view is also changing size, so the UI still needs to adapt as a layout transition.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=1038s">&#9201;&#65039; 17:18</a></p><div><hr></div><h2>Will the Duo simulator gain more first-party apps such as Photos and Files?</h2><p>No direct answer was given because that would involve future releases.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=1235s">&#9201;&#65039; 20:35</a></p><div><hr></div><h2>How should apps handle physical interaction in the seated/tabletop pose?</h2><p>The device is sturdy enough to interact with while seated.</p><p>Frequently used controls can be placed on the bottom half. This also improves reachability and lets the user rest their wrist on the lower part of the device.</p><p>A video app can keep the video on the upper half and move controls to the lower half. An app that involves frequent scrolling may be more naturally used in another pose.</p><p>Controls should not move significantly between poses unless that movement adds enough value.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=1278s">&#9201;&#65039; 21:18</a></p><div><hr></div><h2>What are the first things an existing iPhone app should fix for iPhone Duo?</h2><p>Start by building against the new SDK and running the app in the simulator.</p><p>The items discussed were:</p><ul><li><p>handle the asymmetric safe area</p></li><li><p>make sure bars and controls work in the vertical layout</p></li><li><p>keep text and other content within comfortable readable widths</p></li><li><p>use the extra width for additional content rather than simply stretching existing content</p></li><li><p>consider NavigationSplitView, split views, or Arrangement Views where the hierarchy benefits from multiple columns</p></li><li><p>review assumptions in horizontal carousels and portrait-only layouts</p></li><li><p>use system-managed navigation and tab containers when possible so bars can adapt automatically</p></li></ul><p>For custom overflow menus, items can be added to the system overflow instead of creating an overflow menu inside another overflow menu.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=1499s">&#9201;&#65039; 24:59</a></p><div><hr></div><h2>How should automated UI tests cover Duo poses if XCUI or simctl cannot change the hinge state?</h2><p>If the hooks needed for testing are not exposed, file feedback describing the specific testing use case.</p><p>Apps should still be tested across the different ways Duo can be positioned. iPhone resizing on Mac can also help test how the app responds to different sizes.</p><p>For CI-related feedback, include details such as whether the requirement is snapshot testing and which transitions need to be covered.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=2024s">&#9201;&#65039; 33:44</a></p><div><hr></div><h2>Does WebKit support iPhone Duo folded and unfolded layouts?</h2><p>Web standards include support for hinge position, and WebKit supports that.</p><p>No answer was given about additional future WebKit support.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=2162s">&#9201;&#65039; 36:02</a></p><div><hr></div><h2>Can a game show gameplay on the top half and touch controls on the bottom half in a half-folded pose?</h2><p>Yes.</p><p>An Arrangement View with the overlay mode can stack the views in one configuration and separate them when the device enters the appropriate pose. The app can also read whether the views are stacked and adjust their layout.</p><p>For custom game layouts, corner adaptation can help place controls more precisely around occupied regions. The same API also applies to iPad and Catalyst.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=2202s">&#9201;&#65039; 36:42</a></p><div><hr></div><h2>How should navigation, an unfinished form, and scroll position be preserved when folding changes one column into two panes?</h2><p>Use navigation containers or Arrangement Views that preserve state across the transition.</p><p>Moving between the inner and outer display does not intrinsically tear down the app or its views. The size class changes, though, and a root-level conditional that swaps the entire hierarchy for compact versus regular can tear down state.</p><p>When adding a second column, decide what belongs there. It may be the last selected item, or it may be better to show a content-unavailable state until the user makes a selection.</p><p>An unfinished form and its scroll position should remain stable through the transition.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=2366s">&#9201;&#65039; 39:26</a></p><div><hr></div><h2>When folding or unfolding, is the scene or window recreated? Do lifecycle callbacks fire?</h2><p>The views and view controllers remain the same. Treat opening and closing primarily as an adaptive layout resize rather than separate copies of the app on the two displays.</p><p>onAppear and onDisappear are not expected to fire again just because the device opens or closes.</p><p>A scene phase change can occur in cases such as split view multitasking: if the app was not the most recently interacted-with app, closing the device can move it into the background.</p><p>Use local context such as traits, the scene, view, or view controller rather than relying on main-screen assumptions.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=2599s">&#9201;&#65039; 43:19</a></p><div><hr></div><h2>When Duo is fully open and flat, should the middle area still be avoided?</h2><p>It depends on the app.</p><p>A natural two-column layout can continue to respect the middle so the transition into a partial fold is smaller. It does not have to be 50/50 while flat; a split might be closer to 35/65 and move toward 50/50 as the device folds.</p><p>If the content works better full-width, it can use the full display.</p><p>Scrolling perpendicular to the hinge can work well. Scrolling parallel to the hinge can make some areas harder to interact with.</p><p>Reserved regions can also be requested while inactive, allowing an app to prepare a layout that will already work when the fold becomes active.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=2806s">&#9201;&#65039; 46:46</a></p><div><hr></div><h2>Should an iPhone Duo app use a tab bar or sidebar if the iPhone version uses tabs and the iPad version uses a sidebar?</h2><p>It depends on the hierarchy and content.</p><p>A sidebar can work well when there are many destinations, categories, or subsections that need to be surfaced. A tab bar works well when the app has a smaller number of main areas and the focus is on browsing the content inside them.</p><p>TV keeps the tab-oriented navigation on Duo because the focus is on browsing shows and movies. Settings is an example where the top-level hierarchy maps naturally to a sidebar.</p><p>Consistency between the closed and open states also matters: changing the navigation model when the device opens can work against the muscle memory built while using the app closed.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=3116s">&#9201;&#65039; 51:56</a></p><div><hr></div><h2>Does UITextView preserve reading position when text reflows after unfolding Duo?</h2><p>Yes.</p><p>UITextView and other scroll-view-based components such as collection views and table views anchor to the visible position while the view resizes.</p><p>The inner display reports regular size classes.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=3404s">&#9201;&#65039; 56:44</a></p><div><hr></div><h2>What should game developers consider when adapting gameplay to Duo and foldable layouts?</h2><p>Make the game support different aspect ratios and display sizes.</p><p>Custom game controls do not need to become system vertical bars. In a seated pose, controls can move into the lower area while gameplay remains above them.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=3483s">&#9201;&#65039; 58:03</a></p><div><hr></div><h2>Can the navigation bar stay visible instead of scrolling away on iPhone Duo?</h2><p>Yes.</p><p>On Duo, bars can scroll away by default in some configurations. UIKit navigation-item APIs and SwiftUI toolbar behaviors can change that behavior. The same APIs can also enable or disable scrolling-away behavior on other iPhones.</p><p>For an interface anchored to the bottom, such as Messages, the direction that causes the navigation bar to disappear can be reversed.</p><p>Allowing the bar to scroll away can provide more content space on Duo&#8217;s shorter display.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=3552s">&#9201;&#65039; 59:12</a></p><div><hr></div><h2>How does Picture in Picture work on iPhone Duo?</h2><p>Picture in Picture works the same way as on other iPhones.</p><p>In open portrait mode, Duo also has a control that can pin video to the top of the display. Another app can then run in the lower part without the video occluding it.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=3647s">&#9201;&#65039; 60:47</a></p><div><hr></div><h2>What is the minimum needed for a custom floating tab bar to behave correctly in landscape and partial-fold states?</h2><p>Check which edge the vertical bar is using and get the bar region where the system would place it. A custom horizontal bar can then move into that vertical region when appropriate.</p><p>Another option is to use bar button items with custom views. This keeps the custom content while allowing the system to provide the glass appearance and layout.</p><p><a href="https://www.youtube.com/watch?v=GWz8siwQk8M&amp;t=3703s">&#9201;&#65039; 61:43</a></p><div><hr></div><h2>&#127942; Acknowledgments</h2><p>A huge thank-you to <strong>Anna, Andy, Grant, and Nate</strong> for answering the questions during the lab.</p><p>Thanks as well to everyone who submitted questions about iPhone Duo layouts, poses, bars, camera experiences, testing, navigation, games, StandBy, Picture in Picture, and adaptive UI.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[iOS 27: App Intents Testing]]></title><description><![CDATA[Modern testing of Intents]]></description><link>https://antongubarenko.substack.com/p/ios-27-app-intents-testing</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/ios-27-app-intents-testing</guid><dc:creator><![CDATA[Anton Gubarenko]]></dc:creator><pubDate>Mon, 12 Oct 2026 08:24:57 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/69b708f5-ce4d-4a57-b113-ee2169c6e391_1254x1254.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When we all hear &#8220;Tests, Add Tests&#8221; even in current AI era - it&#8217;s always bring chills. And if with regular classes and UI it&#8217;s a path which a lot of developers took - Intents, in example, are not so typical. And more , App Intents are easy to underestimate because the implementation usually starts with one small type.</p><p>We usually create an <code>AppIntent</code>, add a parameter, implement <code>perform()</code>, run it once from Shortcuts, and everything looks fine. But the Prod integration is much larger than that one method. Siri has to discover the intent, Shortcuts needs to build it from metadata, entity parameters need to resolve from identifiers, Spotlight may query app entities, and outputs from one intent can become inputs to another.</p><p>That is where normal unit testing starts to show its limits for the major cases.</p><p>By calling this directly:</p><pre><code><code>let intent = StartFocusTimerIntent()
try await intent.perform()</code></code></pre><p>tests our Swift implementation. It does <strong>not</strong> prove that the system can discover, construct, resolve, and execute the same intent through App Intents infrastructure.</p><p>iOS 27 introduces <strong>AppIntentsTesting</strong>, and this is the distinction that makes the framework interesting for us as UI test. Tests discover intents by bundle identifier, create them dynamically by name, and run them <strong>out of process</strong> through the same infrastructure used by Siri and Shortcuts. We don&#8217;t even link the UI test target against our app&#8217;s intent types.</p><p>For the demo, let&#8217;s build a small focus-timer utility with presets such as <strong>Deep Work</strong>, <strong>Quick Focus</strong>, and <strong>Reading</strong>. The intent starts a selected timer, while the tests verify not only <code>perform()</code> behavior but also entity resolution and the complete system-facing path.</p><blockquote><p>AppIntents Testing is out of beta framework in the version 27 SDKs and now GM. But all might change as usual.</p></blockquote><div><hr></div><h2>Why a Normal Unit Test Isn&#8217;t Enough</h2><p>Imagine our intent accepts a <code>FocusTimerEntity</code>.</p><p>The app code can be completely correct:</p><pre><code><code>struct StartFocusTimerIntent: AppIntent {

    @Parameter(title: "Timer")
    var timer: FocusTimerEntity

    func perform() async throws -&gt; some IntentResult {
        FocusTimerStore.shared.start(timer)
        return .result()
    }
}</code></code></pre><p>A direct test can instantiate that type and verify that <code>start(_:)</code> is called right away.</p><p>But a real shortcut doesn&#8217;t instantiate <code>FocusTimerEntity</code> the way our unit test does. The system may only have a saved identifier from a shortcut created three months ago:</p><pre><code><code>deep-work</code></code></pre><p>It needs to find our registered entity type, locate its query, resolve the identifier into the current entity model, create the intent, inject the parameter, execute it in the app process, and decode the result back for the calling system feature.</p><p>Any one of those steps can break while a direct <code>perform()</code> unit test stays green.</p><p>That is the gap AppIntentsTesting fills (if you are using Tests). Apple describes the framework as running intents, entities, and queries out of process through the real App Intents infrastructure used by Siri and Shortcuts.</p><div><hr></div><h2>These Are UI Tests, but Not UI Automation</h2><p>This surprised me at first.</p><p>AppIntentsTesting tests belong in a <strong>UI Testing target</strong>:</p><pre><code><code>import XCTest
import AppIntentsTesting</code></code></pre><p>The reason isn&#8217;t that we&#8217;re going to tap buttons with coordinates.</p><p>The framework needs a live app process. The UI testing bundle launches the application, then communicates with its registered App Intents definitions out of process.</p><p>Setup looks like this:</p><pre><code><code>private let app = XCUIApplication()

private var definitions: IntentDefinitions!

override func setUp() async throws {
    app.launch()

    //Demo Identifier!
    definitions = IntentDefinitions(
        bundleIdentifier: "com.example.FocusTimer"
    )
}</code></code></pre><p>That <code>IntentDefinitions</code> value becomes the test&#8217;s entry point into the app&#8217;s registered App Intents world.</p><p>There is no:</p><pre><code><code>@testable import FocusTimer</code></code></pre><p>required for the AppIntentsTesting path.</p><p>That is intentional. If the tests simply imported and instantiated our Swift types, we&#8217;d be back to testing the implementation instead of the registration and execution path the system actually uses.</p><div><hr></div><h2><code>IntentDefinitions</code> Is the Test Catalog</h2><p><code>IntentDefinitions</code> discovers the definitions the app registered with App Intents.</p><p>From one value we can access:</p><pre><code><code>definitions.intents
definitions.entities
definitions.enums
definitions.valueQueries</code></code></pre><p>and retrieve types by their Swift type names:</p><pre><code><code>let intent = definitions
    .intents["StartFocusTimerIntent"]

let entity = definitions
    .entities["FocusTimerEntity"]</code></code></pre><p>This API is type-erased on purpose.</p><p>Our UI test doesn&#8217;t know what <code>StartFocusTimerIntent</code> is as a Swift type. It knows that the running application registered an intent definition with that name.</p><p>That makes the test much closer to an external API consumer, yes.</p><p>If we rename an intent type or forget to register something correctly, the test breaks for the same reason a system integration would break.</p><div><hr></div><h2>Our Entity Needs to Be Queryable</h2><p>The focus timer is an <code>AppEntity</code>:</p><pre><code><code>struct FocusTimerEntity: AppEntity, Identifiable, Hashable {

    static let typeDisplayRepresentation = TypeDisplayRepresentation(
        name: "Focus Timer"
    )

    static let defaultQuery = FocusTimerQuery()

    var id: String
    private let titleValue: String
    private let durationValue: Int

    @ComputedProperty(title: "Title")
    var title: String {
        titleValue
    }

    @ComputedProperty(title: "Duration")
    var duration: Int {
        durationValue
    }

    init(id: String, title: String, duration: Int) {
        self.id = id
        self.titleValue = title
        self.durationValue = duration
    }

    static func == (lhs: FocusTimerEntity, rhs: FocusTimerEntity) -&gt; Bool {
        lhs.id == rhs.id
    }

    func hash(into hasher: inout Hasher) {
        hasher.combine(id)
    }
}</code></code></pre><p>The important piece for testing is not the display representation. It is the stable identifier and query. <a href="https://developer.apple.com/documentation/appintents/appentity">More about AppEntity.</a></p><p>A shortcut can store <code>"deep-work"</code> and resolve it later, so our query implements identifier lookup:</p><pre><code><code>func entities(
    for identifiers: [FocusTimerEntity.ID]
) async throws -&gt; [FocusTimerEntity] {
    await FocusTimerStore.shared.timers.filter {
        identifiers.contains($0.id)
    }
}</code></code></pre><p>It also supports string search (use <code>string.localizedLowercase</code>):</p><pre><code><code>func entities(
    matching string: String
) async throws -&gt; [FocusTimerEntity] {
    let query = string.localizedLowercase

    return await FocusTimerStore.shared.timers.filter {
        $0.title.localizedLowercase.contains(query)
    }
}</code></code></pre><p>This code is part of the external behavior of the intent integration.</p><p>If a persistence migration changes <code>"deep-work"</code> to some generated UUID and we don&#8217;t migrate existing shortcuts, <code>perform()</code> can still be perfect while users&#8217; automations fail.</p><div><hr></div><h2>Run an Intent Through the Real Infrastructure</h2><p>This is the first test that actually shows why AppIntentsTesting exists.</p><p>Create a reference to the saved entity identifier:</p><pre><code><code>let timer = definitions
    .entities["FocusTimerEntity"]
    .makeReference(
        identifier: "deep-work"
    )</code></code></pre><p>Then create the intent dynamically:</p><pre><code><code>let intent = definitions
    .intents["StartFocusTimerIntent"]
    .makeIntent(
        timer: timer
    )</code></code></pre><p>And run it:</p><pre><code><code>let result = try await intent.run()</code></code></pre><p><code>run()</code> sends the intent into the live app for processing through App Intents infrastructure. Apple explicitly calls out that this is the same path system integrations use.</p><p>Now we&#8217;re testing much more than one Swift method:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!W77y!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F238f2060-07a0-4a7b-8299-bc40f6dd31d1_1024x1536.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!W77y!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F238f2060-07a0-4a7b-8299-bc40f6dd31d1_1024x1536.png 424w, https://substackcdn.com/image/fetch/$s_!W77y!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F238f2060-07a0-4a7b-8299-bc40f6dd31d1_1024x1536.png 848w, https://substackcdn.com/image/fetch/$s_!W77y!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F238f2060-07a0-4a7b-8299-bc40f6dd31d1_1024x1536.png 1272w, https://substackcdn.com/image/fetch/$s_!W77y!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F238f2060-07a0-4a7b-8299-bc40f6dd31d1_1024x1536.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!W77y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F238f2060-07a0-4a7b-8299-bc40f6dd31d1_1024x1536.png" width="558" height="837" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/238f2060-07a0-4a7b-8299-bc40f6dd31d1_1024x1536.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1536,&quot;width&quot;:1024,&quot;resizeWidth&quot;:558,&quot;bytes&quot;:1454213,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/219050682?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F238f2060-07a0-4a7b-8299-bc40f6dd31d1_1024x1536.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!W77y!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F238f2060-07a0-4a7b-8299-bc40f6dd31d1_1024x1536.png 424w, https://substackcdn.com/image/fetch/$s_!W77y!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F238f2060-07a0-4a7b-8299-bc40f6dd31d1_1024x1536.png 848w, https://substackcdn.com/image/fetch/$s_!W77y!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F238f2060-07a0-4a7b-8299-bc40f6dd31d1_1024x1536.png 1272w, https://substackcdn.com/image/fetch/$s_!W77y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F238f2060-07a0-4a7b-8299-bc40f6dd31d1_1024x1536.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Flow sample</figcaption></figure></div><p>That is the real value of the framework.</p><div><hr></div><h2>Results Are Dynamic Too</h2><p>Because the test target doesn&#8217;t import our app entity type, the returned entity is also type-erased:</p><pre><code><code>let returnedTimer: AnyAppEntity = try result.value</code></code></pre><p>Properties can then be accessed dynamically:</p><pre><code><code>let id: String = returnedTimer.identifier.instanceIdentifier
let title: String = try returnedTimer.title
let duration: Int = try returnedTimer.duration</code></code></pre><p>and verified normally (I use String, but enum might work also):</p><pre><code><code>XCTAssertEqual(id, "deep-work")
XCTAssertEqual(title, "Deep Work")
XCTAssertEqual(duration, 50)</code></code></pre><p><code>AnyAppIntent</code> and <code>AnyAppEntity</code> use dynamic member lookup to bridge the gap between compile-time isolation and type-safe test assertions.</p><p>There is a little more ceremony than importing the app model directly.</p><p>That&#8217;s a feature, not a bug ) Or we hope so )</p><p>We&#8217;re proving that the value can cross the App Intents boundary, not merely that two local Swift structs are equal.</p><div><hr></div><h2>Test Entity Search Directly</h2><p>Intent execution isn&#8217;t the only thing worth testing!</p><p><code>AppEntityDefinition.entities(matching:)</code> runs the app&#8217;s registered entity query:</p><pre><code><code>let timers = try await definitions
    .entities["FocusTimerEntity"]
    .entities(
        matching: "Quick"
    )</code></code></pre><p>Then we inspect the result:</p><pre><code><code>XCTAssertEqual(timers.count, 1)

let title: String = try timers[0].title
let duration: Int = try timers[0].duration

XCTAssertEqual(title, "Quick Focus")
XCTAssertEqual(duration, 25)</code></code></pre><p>Apple specifically exposes this API so tests can verify entity queries the same way system features query them.</p><p>For apps with documents, projects, workouts, playlists, or contacts, you might consider these query tests just as important as intent tests.</p><p>The query is often what determines whether Siri or Spotlight can find the object in the first place.</p><div><hr></div><h2>Test Stable Identifiers</h2><p>We can also query by identifiers:</p><pre><code><code>let timers = try await definitions
    .entities["FocusTimerEntity"]
    .entities(
        identifiers: ["reading"]
    )</code></code></pre><p>This is one of the tests I&#8217;d keep permanently.</p><p>App Entity identifiers can survive much longer than one app session. Existing shortcuts, automation chains, and system references may all depend on them.</p><p>So this assertion:</p><pre><code><code>let id: String = timers[0].identifier.instanceIdentifier

XCTAssertEqual(
    id,
    "reading"
)</code></code></pre><p>is checking compatibility with already-created automations.</p><div><hr></div><h2>Let Entities Flow Between Tests and Intents</h2><p>One of the nicer parts of AppIntentsTesting is that a type-erased entity returned from a query can go directly into another intent.</p><p>First find the timer:</p><pre><code><code>let matches = try await definitions
    .entities["FocusTimerEntity"]
    .entities(
        matching: "Deep"
    )</code></code></pre><p>Then pass the result directly:</p><pre><code><code>let result = try await definitions
    .intents["StartFocusTimerIntent"]
    .makeIntent(
        timer: matches[0]
    )
    .run()</code></code></pre><p>We don&#8217;t manually convert the entity into our app&#8217;s Swift type.</p><p>The framework carries it across the same App Intents boundary the system uses. Apple highlights this pattern for testing real multi-intent workflows where one action produces an entity that becomes an input to the next.</p><p>This becomes especially useful for flows like:</p><pre><code><code>Find Project
    &#8595;
Create Task
    &#8595;
Add Tag
    &#8595;
Open Task</code></code></pre><p>A unit test for each <code>perform()</code> method independently won&#8217;t tell us whether the entity references survive that chain. Flow is plain enough.</p><div><hr></div><h2>Test Setup Without UI Automation</h2><p>Out-of-process testing introduces a new question:</p><blockquote><p>How do we put the running app into a known state?</p></blockquote><p>We could launch the app and automate buttons until the database looks right. I wouldn&#8217;t.</p><p><strong>Apple recommends test-only intents for setup and teardown.</strong></p><p>The sample includes:</p><pre><code><code>#if DEBUG
struct ResetFocusTimerTestStateIntent: AppIntent {

    static let title: LocalizedStringResource =
        "Reset Focus Timer Test State"

    static let isDiscoverable = false

    @MainActor
    func perform() async throws -&gt; some IntentResult {
        FocusTimerStore.shared.seed()
        return .result()
    }
}
#endif</code></code></pre><p>There are two important details here.</p><p><code>isDiscoverable = false</code> keeps the intent out of Siri and Shortcuts.</p><p><code>#if DEBUG</code> keeps it out of release builds entirely.</p><p>Then <code>setUp()</code> can reset the application through the same out-of-process mechanism:</p><pre><code><code>try await definitions
    .intents["ResetFocusTimerTestStateIntent"]
    .makeIntent()
    .run()</code></code></pre><p>I like this pattern much more than navigating a UI just to create test fixtures.</p><p>The intent test remains independent of the app&#8217;s screen hierarchy.</p><div><hr></div><h2>Don&#8217;t Replace Unit Tests</h2><p>After seeing the new framework, it would be easy to move every App Intent test into UI testing. I wouldn&#8217;t do this also.</p><p>A direct unit test is still cheaper when the thing we want to prove is application logic:</p><pre><code><code>let service = FocusTimerService(...)
try await service.start(timer)</code></code></pre><p>Use that for:</p><ul><li><p>validation</p></li><li><p>database updates</p></li><li><p>networking</p></li><li><p>business rules</p></li><li><p>notification scheduling</p></li><li><p>error mapping</p></li></ul><p>Then use AppIntentsTesting for the App Intents boundary:</p><ul><li><p>intent discovery</p></li><li><p>entity resolution</p></li><li><p>dynamic parameters</p></li><li><p>result transfer</p></li><li><p>chained intents</p></li><li><p>Spotlight queries</p></li><li><p>system-facing integration</p></li></ul><p>A useful architecture still looks like:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rMTT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1271927b-aa29-47ed-aa4e-5696efc59323_1536x1024.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rMTT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1271927b-aa29-47ed-aa4e-5696efc59323_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!rMTT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1271927b-aa29-47ed-aa4e-5696efc59323_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!rMTT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1271927b-aa29-47ed-aa4e-5696efc59323_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!rMTT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1271927b-aa29-47ed-aa4e-5696efc59323_1536x1024.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!rMTT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1271927b-aa29-47ed-aa4e-5696efc59323_1536x1024.png" width="612" height="408.1401098901099" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1271927b-aa29-47ed-aa4e-5696efc59323_1536x1024.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:971,&quot;width&quot;:1456,&quot;resizeWidth&quot;:612,&quot;bytes&quot;:1344844,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/219050682?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1271927b-aa29-47ed-aa4e-5696efc59323_1536x1024.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rMTT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1271927b-aa29-47ed-aa4e-5696efc59323_1536x1024.png 424w, https://substackcdn.com/image/fetch/$s_!rMTT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1271927b-aa29-47ed-aa4e-5696efc59323_1536x1024.png 848w, https://substackcdn.com/image/fetch/$s_!rMTT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1271927b-aa29-47ed-aa4e-5696efc59323_1536x1024.png 1272w, https://substackcdn.com/image/fetch/$s_!rMTT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1271927b-aa29-47ed-aa4e-5696efc59323_1536x1024.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The intent should remain an adapter.</p><p>AppIntentsTesting doesn&#8217;t make <code>perform()</code> a good place to put the entire application.</p><div><hr></div><h2>Testing Spotlight and Onscreen Context</h2><p>The testing API goes further than what we&#8217;re covering here.</p><p><code>AppEntityDefinition</code> can perform Spotlight queries, which means tests can verify that entities intended for Spotlight are actually discoverable through the system-facing path.</p><p>AppIntentsTesting also exposes <code>ViewAnnotation</code>, representing the onscreen App Entity context an app provides to the system. Tests can retrieve visible annotations and verify which entity is visible or selected.</p><p>I&#8217;m deliberately stopping at intents, entities, and queries because those are the system integrations this sample actually uses.</p><p>A timer utility doesn&#8217;t need a fake Spotlight feature only so the article can mention another API. These tests become much more valuable in apps where searchable entities and onscreen semantic context are real product features.</p><p>That is probably a good follow-up article rather than another 200 lines in this one.</p><div><hr></div><h2>UI Testing Without UI Fragility</h2><p>This is probably my favorite part of the framework.</p><p>The tests live in a UI Testing target, but our main test looks like:</p><pre><code><code>let result = try await definitions
    .intents["StartFocusTimerIntent"]
    .makeIntent(
        timer: timer
    )
    .run()</code></code></pre><p>There are no accessibility identifiers.</p><p>No coordinates.</p><p>No waiting for a button to appear.</p><p>No Shortcuts UI automation.</p><p>The UI Testing target is being used as an out-of-process test host.</p><p>That makes these tests much closer to integration tests than traditional UI tests, and Apple says they&#8217;re fast enough for frequent CI workflows.</p><div><hr></div><h2>A Rename Can Be a Breaking Change</h2><p>Because definitions are looked up by type name:</p><pre><code><code>definitions
    .intents["StartFocusTimerIntent"]</code></code></pre><p>and entities similarly:</p><pre><code><code>definitions
    .entities["FocusTimerEntity"]</code></code></pre><p>the tests also make registration changes very visible.</p><p>If a refactor renames an intent, changes an entity ID strategy, or removes a query capability, the test suite can catch the external consequence.</p><blockquote><p>That is important because App Intents are increasingly less like private implementation details and more like an API exposed to the operating system.</p></blockquote><p>Once Siri, Shortcuts, Spotlight, controls, widgets, or automations depend on that contract, &#8220;just rename the model&#8221; isn&#8217;t always harmless anymore.</p><div><hr></div><h2>Complete Project</h2><p>Here is something you can play-along. A real AppIntentsTesting example spans <strong>two targets</strong>, so I don&#8217;t want to hide that behind one fake single-file project.</p><p>The downloadable sample therefore contains many Swift files:</p><pre><code><code>FocusTimerEntity.swift
    &#8594; add to the application target

IntentUITest.swift
    &#8594; add to the UI Testing target</code></code></pre><p>The app target defines:</p><ul><li><p><code>FocusTimerEntity</code></p></li><li><p><code>FocusTimerQuery</code></p></li><li><p><code>StartFocusTimerIntent</code></p></li><li><p>a Debug-only reset intent</p></li></ul><p>The UI test target:</p><ul><li><p>launches the live app</p></li><li><p>creates <code>IntentDefinitions</code></p></li><li><p>resolves entities by identifier</p></li><li><p>searches entities by text</p></li><li><p>runs <code>StartFocusTimerIntent</code> out of process</p></li><li><p>reads <code>ResolvedIntentResult</code></p></li><li><p>passes a queried <code>AnyAppEntity</code> directly into an intent</p><p></p></li></ul><p><code>IntentDefinitions</code> must use the bundle identifier of the application under test. In this sample:</p><pre><code><code>bundleIdentifier: "com.example.FocusTimer"</code></code></pre><p>All <a href="https://gist.github.com/lanserxt/db9fd6c2ada199ebc7339e442d172dbe">project files are here</a></p><div><hr></div><h2>Where It Fits</h2><p>Consider adding AppIntentsTesting when an App Intent has moved from experiment to product surface.</p><p>If breaking an intent would break a Shortcut someone relies on, remove an entity from Spotlight, or make Siri unable to resolve a saved object, that integration deserves regression tests.</p><p>The framework is especially useful for apps with:</p><ul><li><p>many App Entities</p></li><li><p>stable entity references</p></li><li><p>chained intents</p></li><li><p>searchable app content</p></li><li><p>custom queries</p></li><li><p>long-lived user shortcuts</p></li><li><p>several system entry points built on the same App Intents definitions</p></li></ul><p>The important shift is that we no longer need to treat App Intents as something we manually verify by opening Shortcuts before release.</p><p>They can be part of CI like the rest of the application contract.</p><div><hr></div><h2>Limitations</h2><p>A few things you should keep in mind:</p><ul><li><p>AppIntentsTesting is beta in the version 27 SDKs.</p></li><li><p>Tests belong in a UI Testing target because they run against a live app process.</p></li><li><p>The framework executes intents out of process through real App Intents infrastructure.</p></li><li><p>Tests use type-erased definitions rather than importing app intent types directly.</p></li><li><p>Definition lookup uses registered type names.</p></li><li><p>App Entity identifiers need stability if existing shortcuts depend on them.</p></li><li><p>AppIntentsTesting complements normal unit tests rather than replacing them.</p></li><li><p>Test-only setup intents should be nondiscoverable and excluded from release builds.</p></li><li><p>Don&#8217;t use UI automation when a test-only intent can establish state more deterministically.</p></li><li><p>Test only system integrations your product actually uses; don&#8217;t manufacture Spotlight or Siri behavior just to increase coverage.</p></li></ul><p>For me, the biggest benefit isn&#8217;t another testing framework. It&#8217;s finally being able to test an App Intent as the <strong>operating system sees it</strong>, rather than only as a Swift type we happen to own.</p><p>Have a nice coding!</p><div><hr></div><h2>References</h2><ul><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/appintentstesting">App Intents Testing</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/appintentstesting/testing-your-app-intents-code">Testing your App Intents code</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/appintentstesting/intentdefinitions">IntentDefinitions</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/appintentstesting/anyappintent">AnyAppIntent</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/appintentstesting/appintentdefinition">AppIntentDefinition</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/appintentstesting/appentitydefinition">AppEntityDefinition</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/appintentstesting/viewannotation">ViewAnnotation</a></p></li><li><p>Apple Developer Video: <a href="https://developer.apple.com/videos/play/wwdc2026/295/">Validate your App Intents adoption with AppIntentsTesting</a></p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[iOS 27: Trust Insights Framework]]></title><description><![CDATA[Analyze transactions for signs of coercive activity while protecting people&#8217;s privacy]]></description><link>https://antongubarenko.substack.com/p/ios-27-trust-insights-framework</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/ios-27-trust-insights-framework</guid><pubDate>Tue, 06 Oct 2026 06:01:08 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/6a1e1cc9-f8e0-4254-9616-96408f9326e4_1254x1254.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Most security APIs answer technical questions. Is this device genuine? Did the request come from my app? Is this credential valid? Did the server signature match?</p><p>Social engineering is different because the app can see a completely legitimate action while the person performing it is being manipulated into doing it.</p><p>Think about a remote-support utility. Starting a support session is a valid feature. The user taps the correct button, enters a valid support code, and intentionally starts the connection. From the app&#8217;s point of view, nothing is technically wrong. But if someone on the phone is coaching that user through the process as part of a scam, our normal fraud checks may have very little to work with.</p><p>iOS 27 introduces <strong>Trust Insights</strong>, a framework that lets an app request privacy-preserving signals for situations like this. The first available insight is <code>IsLikelyBeingCoachedInsight</code>, which evaluates whether there are indications that someone may be actively coaching the person through an operation. The result can then become one more input into our own risk decision: continue normally, add verification, show a warning, or block the action.</p><p>The important part is that Trust Insights doesn&#8217;t tell us whether a person is <em>definitely</em> being scammed. It gives us an additional trust signal. Apple explicitly notes that coaching isn&#8217;t necessarily malicious, and even an <code>.unknown</code> result means only that the system found no evidence of coaching &#8212; not that the operation is safe.</p><blockquote><p>Trust Insights is out of beta framework in the iOS 27 SDK. The only restrictions left are the region. And unfortunately, it&#8217;s hard to find the list of available ones. I had to jump into some European regions to at least make it pass the warning.</p></blockquote><div><hr></div><h2>A Different Kind of Security Signal</h2><p>Let&#8217;s keep the example outside Apple&#8217;s transaction demo and build a small <strong>remote-support utility</strong>.</p><p>Remote-support software is useful, but it is also a common ingredient in social-engineering attacks. A scammer doesn&#8217;t have to exploit the app. They can simply convince someone to install it, read out a support code, and start a perfectly valid session.</p><p>Our app can&#8217;t reliably infer intent from the button tap itself:</p><pre><code><code>- User tapped "Start Support"
- Support code is valid
- Network connection is valid
- Account is authenticated</code></code></pre><p>Every technical check can pass.</p><p>Trust Insights adds another question:</p><blockquote><p>Are there indications that this person is being coached
while performing this operation?</p></blockquote><p>The framework currently exposes five operation categories that give the evaluation context: <code>.payment</code>, <code>.account</code>, <code>.resourceUse</code>, <code>.communication</code>, and <code>.other</code>. For a remote-support connection, <code>.communication</code> is the closest fit because the action creates a connection to another person. Apple notes that choosing the most relevant category matters for transparency and can also affect evaluation behavior.</p><p>Let&#8217;s enable such checks&#8230;</p><div><hr></div><h2>Enable the Capability First</h2><p>Trust Insights requires the <code>com.apple.developer.trustinsights.base</code> entitlement. The normal way to add it is through your target&#8217;s <strong>Signing &amp; Capabilities</strong> settings by adding the Trust Insights capability.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ttsG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4815cbac-7662-4f32-9df1-ced82f04f1bf_1328x550.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ttsG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4815cbac-7662-4f32-9df1-ced82f04f1bf_1328x550.png 424w, https://substackcdn.com/image/fetch/$s_!ttsG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4815cbac-7662-4f32-9df1-ced82f04f1bf_1328x550.png 848w, https://substackcdn.com/image/fetch/$s_!ttsG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4815cbac-7662-4f32-9df1-ced82f04f1bf_1328x550.png 1272w, https://substackcdn.com/image/fetch/$s_!ttsG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4815cbac-7662-4f32-9df1-ced82f04f1bf_1328x550.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!ttsG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4815cbac-7662-4f32-9df1-ced82f04f1bf_1328x550.png" width="648" height="268.3734939759036" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4815cbac-7662-4f32-9df1-ced82f04f1bf_1328x550.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:550,&quot;width&quot;:1328,&quot;resizeWidth&quot;:648,&quot;bytes&quot;:62695,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/211332535?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4815cbac-7662-4f32-9df1-ced82f04f1bf_1328x550.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ttsG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4815cbac-7662-4f32-9df1-ced82f04f1bf_1328x550.png 424w, https://substackcdn.com/image/fetch/$s_!ttsG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4815cbac-7662-4f32-9df1-ced82f04f1bf_1328x550.png 848w, https://substackcdn.com/image/fetch/$s_!ttsG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4815cbac-7662-4f32-9df1-ced82f04f1bf_1328x550.png 1272w, https://substackcdn.com/image/fetch/$s_!ttsG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4815cbac-7662-4f32-9df1-ced82f04f1bf_1328x550.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Trust Insights at Signing &amp; Capabilities </figcaption></figure></div><p>and</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8jux!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dee4fa3-73eb-4a68-baf7-e3282b37230a_1350x116.png 424w, https://substackcdn.com/image/fetch/$s_!8jux!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dee4fa3-73eb-4a68-baf7-e3282b37230a_1350x116.png 848w, https://substackcdn.com/image/fetch/$s_!8jux!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dee4fa3-73eb-4a68-baf7-e3282b37230a_1350x116.png 1272w, https://substackcdn.com/image/fetch/$s_!8jux!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dee4fa3-73eb-4a68-baf7-e3282b37230a_1350x116.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!8jux!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dee4fa3-73eb-4a68-baf7-e3282b37230a_1350x116.png" width="1350" height="116" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7dee4fa3-73eb-4a68-baf7-e3282b37230a_1350x116.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:116,&quot;width&quot;:1350,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:67499,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/211332535?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dee4fa3-73eb-4a68-baf7-e3282b37230a_1350x116.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8jux!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dee4fa3-73eb-4a68-baf7-e3282b37230a_1350x116.png 424w, https://substackcdn.com/image/fetch/$s_!8jux!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dee4fa3-73eb-4a68-baf7-e3282b37230a_1350x116.png 848w, https://substackcdn.com/image/fetch/$s_!8jux!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dee4fa3-73eb-4a68-baf7-e3282b37230a_1350x116.png 1272w, https://substackcdn.com/image/fetch/$s_!8jux!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7dee4fa3-73eb-4a68-baf7-e3282b37230a_1350x116.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div><figcaption class="image-caption">Entitlements setup</figcaption></figure></div><p>or you will get</p><blockquote><p>Fatal error: TrustInsights requires &#8220;com.apple.developer.trustinsights.base&#8221; entitlement of type array containing &#8220;InsightSuiteStandard&#8221;</p></blockquote><p>That isn&#8217;t optional setup. Without the entitlement, evaluation requests can&#8217;t work and as you see above will crash.</p><p>The framework also requires user authorization before an app can request evaluations. That makes sense because this is a sensitive signal about the circumstances around someone&#8217;s actions, not a background fraud API we should silently enable.</p><div><hr></div><h2>Creating an Insight Request</h2><p>Trust Insights is built around <code>InsightEvaluator</code>.</p><p>The framework currently supports one concrete insight:</p><pre><code><code>let request = IsLikelyBeingCoachedInsight.request(
    schema: .version1,
    modelVersion: .current
)</code></code></pre><p>There are two version choices in that line. <code>schema</code> describes the shape of the insight result, and the first available schema is <code>.version1</code>. <code>modelVersion</code> selects the fraud model. In normal applications Apple recommends <code>.current</code>, which means the latest model available as fraud patterns evolve. A specific model version can also be requested when there is a particular compatibility or regulatory reason to do it.</p><p>I would keep <code>.current</code> unless the product has a concrete reason not to.</p><div><hr></div><h2>Add Operation Context</h2><p>An insight request by itself isn&#8217;t enough. We also tell the framework what kind of operation the person is about to perform:</p><pre><code><code>var context = InsightEvaluator.InsightContext(
    operationCategory: .communication,
    requestedEvaluations: request
)</code></code></pre><p>This creates a typed <code>InsightContext</code> containing the requested insight.</p><p>The available categories are intentionally broad:</p><pre><code><code>.payment       payment or purchase
.account       registration, login, account changes
.resourceUse   expensive computation or online resource
.communication communication or connecting to another person
.other         operations that don't fit the existing categories</code></code></pre><p>For our remote-support utility, <code>.communication</code> gives Apple the right high-level context without sending our entire product model into the framework.</p><div><hr></div><h2>Use a Request ID</h2><p><code>InsightContext</code> also has an optional <code>requestID</code>, and I would use it.</p><pre><code><code>let requestID = UUID().uuidString
context.requestID = requestID</code></code></pre><p>The returned <code>InsightEvaluation</code> includes the request ID again. Apple&#8217;s documentation says that if the returned value doesn&#8217;t match the one supplied in the context, the app shouldn&#8217;t trust the payload because it could indicate that something was injected or mismatched.</p><p>So after evaluation, verify it:</p><pre><code><code>guard evaluation.requestID == requestID else {
    evaluation.reportConsumption(.notUsedError)
    return
}</code></code></pre><p>A request ID is also useful for connecting the evaluation with our own transaction or support-session record without exposing that identifier as an insight itself.</p><div><hr></div><h2>Authorization</h2><p>Before asking for an evaluation, check authorization:</p><pre><code><code>let status = try await evaluator.authorizationStatus(
    for: context
)</code></code></pre><p><code>AuthorizationStatus</code> currently has five cases:</p><pre><code><code>authorized
denied
deniedRequestable
notDetermined
unavailable</code></code></pre><p>The two interesting middle cases are <code>.notDetermined</code> and <code>.deniedRequestable</code>. In those states we can present the authorization request:</p><pre><code><code>let status = try await evaluator.requestAuthorization(
    for: context
)</code></code></pre><p><code>requestAuthorization(for:)</code> is asynchronous and doesn&#8217;t return until the user has completed the permission UI. If access has already been granted, it returns immediately.</p><p>I wouldn&#8217;t treat denial or unavailability as automatic proof that the operation is risky. Trust Insights is one signal, so a production app should fall back to its existing risk checks when the framework can&#8217;t provide an evaluation.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RCH4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c72bc47-f531-411c-85cb-a3ff50197528_589x1280.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RCH4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c72bc47-f531-411c-85cb-a3ff50197528_589x1280.jpeg 424w, https://substackcdn.com/image/fetch/$s_!RCH4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c72bc47-f531-411c-85cb-a3ff50197528_589x1280.jpeg 848w, https://substackcdn.com/image/fetch/$s_!RCH4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c72bc47-f531-411c-85cb-a3ff50197528_589x1280.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!RCH4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c72bc47-f531-411c-85cb-a3ff50197528_589x1280.jpeg 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!RCH4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c72bc47-f531-411c-85cb-a3ff50197528_589x1280.jpeg" width="589" height="1280" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8c72bc47-f531-411c-85cb-a3ff50197528_589x1280.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1280,&quot;width&quot;:589,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:87766,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/211332535?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c72bc47-f531-411c-85cb-a3ff50197528_589x1280.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RCH4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c72bc47-f531-411c-85cb-a3ff50197528_589x1280.jpeg 424w, https://substackcdn.com/image/fetch/$s_!RCH4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c72bc47-f531-411c-85cb-a3ff50197528_589x1280.jpeg 848w, https://substackcdn.com/image/fetch/$s_!RCH4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c72bc47-f531-411c-85cb-a3ff50197528_589x1280.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!RCH4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8c72bc47-f531-411c-85cb-a3ff50197528_589x1280.jpeg 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><h2>Requesting the Evaluation</h2><p>Once the user has authorized access, evaluation is straightforward:</p><pre><code><code>let evaluator = InsightEvaluator()

let evaluation = try await evaluator.requestEvaluation(
    context: context
)</code></code></pre><p>There is one practical UX detail here: this isn&#8217;t necessarily instant. Apple says the evaluation includes processing both on-device and on Apple servers and can take several seconds.</p><p>That means I wouldn&#8217;t put this behind an invisible button tap and hope it returns before anyone notices. The sample has an explicit &#8220;Checking this session&#8221; state, and a real app should design this into the flow with existing loading UI or a short interstitial.</p><p>During development, Trust Insights requests use a sandbox environment. App Store-distributed apps use production models and servers. Apple also provides development overrides for insight values and errors through Xcode scheme launch arguments, which is important because we obviously don&#8217;t want to reproduce a real scam just to test <code>.high</code>.</p><div><hr></div><h2>Reading <code>IsLikelyBeingCoachedInsight</code></h2><p>For a single requested insight, the result is available through:</p><pre><code><code>let insight = evaluation.insight</code></code></pre><p>The outcome itself is a <code>Result</code>, because an individual insight can fail independently from the overall evaluation request:</p><pre><code><code>switch try insight.outcome.get() {
case .unknown:
    // No evidence of coaching.
case .medium:
    // Some evidence of coaching.
case .high:
    // Significant evidence of coaching.
@unknown default:
    break
}</code></code></pre><p>This two-level error model is worth noticing. <code>requestEvaluation(context:)</code> can throw an <code>EvaluationError</code> when the overall evaluation fails, while <code>insight.outcome</code> can contain an <code>InsightError</code> for that specific insight. Handle both.</p><div><hr></div><h2><code>.unknown</code> Doesn&#8217;t Mean &#8220;Safe&#8221;</h2><p>The three outcomes are deliberately not named <code>low</code>, <code>medium</code>, and <code>high</code>.</p><p>The first one is <code>.unknown</code>.</p><p>Apple describes it as no evidence of scam risk, but explicitly says <strong>not to interpret it as low risk</strong>. That distinction matters. Trust Insights doesn&#8217;t replace all of our existing fraud, device, account, or product checks.</p><p>In the remote-support demo, <code>.unknown</code> means Trust Insights doesn&#8217;t add an extra warning. The app can continue with its normal checks:</p><pre><code><code>case .unknown:
    evaluation.reportConsumption(.usedReducedFriction)
    state = .readyToConnect</code></code></pre><p>If your product already requires another verification step for every remote connection, an <code>.unknown</code> result might not change the flow at all. In that case <code>.usedUnchangedFriction</code> could be the more honest consumption status.</p><div><hr></div><h2>Medium and High Signals</h2><p><code>.medium</code> means there is some evidence of coaching. Depending on the product, Apple suggests introducing friction, additional verification, or adjusting risk scoring.</p><p><code>.high</code> represents significant evidence. Apple recommends informing the user about the determined risks before they proceed.</p><p>For our utility, I use both signals to introduce an extra confirmation step:</p><pre><code><code>case .medium:
    pendingEvaluation = evaluation
    state = .warning(.medium)

case .high:
    pendingEvaluation = evaluation
    state = .warning(.high)</code></code></pre><p>The warning text differs, but the key behavior is the same: don&#8217;t silently start the remote session. Ask the user to verify who requested the connection and give them a clear way to stop.</p><p>This is deliberately only a demo policy. A banking app, account-recovery flow, or high-value purchase may use a stricter policy. Trust Insights provides the signal; your app still owns the decision.</p><h2>Report How You Used the Insight</h2><p>This part is easy to skip, but it is part of the framework&#8217;s design.</p><p>After using an evaluation, report what happened:</p><pre><code><code>evaluation.reportConsumption(
    .usedIncreasedFriction
)</code></code></pre><p>Available consumption statuses describe whether the insight changed the experience:</p><pre><code><code>notUsedError
notUsedNotNeeded
usedEvaluationOnly
usedIncreasedFriction
usedReducedFriction
usedUnchangedFriction</code></code></pre><p>If a medium or high result causes us to show another confirmation step, <code>.usedIncreasedFriction</code> fits. If <code>.unknown</code> lets us bypass an extra verification step, <code>.usedReducedFriction</code> fits. If we inspect the insight but don&#8217;t change anything, use <code>.usedUnchangedFriction</code>.</p><p>This feedback helps Apple understand how insights are consumed without forcing us to send an entire private transaction record back through the API.</p><div><hr></div><h2>Evaluation Metadata</h2><p><code>InsightEvaluation</code> contains more than the outcome.</p><p>Useful properties include:</p><pre><code><code>evaluation.requestID
evaluation.generationTimestamp
evaluation.serverTimestamp
evaluation.additionalInfo
evaluation.eventID
evaluation.signedPayload</code></code></pre><p>The insight itself also exposes model information:</p><pre><code><code>insight.modelVersion
insight.newestModelVersion
insight.isUsingCurrentModel
insight.insightID</code></code></pre><p>For an on-device decision, the summarized <code>insight</code> result is the easy path.</p><p>For a server-side access decision, Apple recommends sending <code>signedPayload</code> to the server and validating its signature there. The payload is signed CBOR data. That is a much stronger architecture when the server, rather than the iOS app, ultimately controls access to something valuable.</p><p>I would avoid making a high-value server decision based only on a Boolean sent from the client such as:</p><pre><code><code>{
  "coachingRisk": "unknown"
}</code></code></pre><p>If the backend owns the decision, send the signed payload and verify it on the backend.</p><div><hr></div><h2>Privacy</h2><p>The privacy model is probably the most interesting part of Trust Insights.</p><p>Apple explains that device-sourced data is processed locally and discarded after evaluation. Only a single output value leaves the device for the coaching insight. The final result may also incorporate Apple Account signals and velocity checks on Apple&#8217;s side.</p><p>That doesn&#8217;t make the feature consequence-free. The app still needs permission, chooses the operation context, receives a trust result, and makes a product decision from it. Treat the result as security-sensitive information and don&#8217;t turn it into another analytics property casually.</p><p>Also remember that coaching itself isn&#8217;t proof of malicious behavior. A family member may legitimately guide someone through an unfamiliar app. The framework is designed to support extra checks and risk decisions, not to label the person or their conversation as fraudulent.</p><div><hr></div><h2>A Remote-Support Flow</h2><p>Our demo ends up with a fairly simple decision tree:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_1Lj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2353bd9f-abd1-423c-b45c-9175368288a1_1024x1536.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_1Lj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2353bd9f-abd1-423c-b45c-9175368288a1_1024x1536.png 424w, https://substackcdn.com/image/fetch/$s_!_1Lj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2353bd9f-abd1-423c-b45c-9175368288a1_1024x1536.png 848w, https://substackcdn.com/image/fetch/$s_!_1Lj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2353bd9f-abd1-423c-b45c-9175368288a1_1024x1536.png 1272w, https://substackcdn.com/image/fetch/$s_!_1Lj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2353bd9f-abd1-423c-b45c-9175368288a1_1024x1536.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!_1Lj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2353bd9f-abd1-423c-b45c-9175368288a1_1024x1536.png" width="528" height="792" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2353bd9f-abd1-423c-b45c-9175368288a1_1024x1536.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1536,&quot;width&quot;:1024,&quot;resizeWidth&quot;:528,&quot;bytes&quot;:1614018,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/211332535?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2353bd9f-abd1-423c-b45c-9175368288a1_1024x1536.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_1Lj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2353bd9f-abd1-423c-b45c-9175368288a1_1024x1536.png 424w, https://substackcdn.com/image/fetch/$s_!_1Lj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2353bd9f-abd1-423c-b45c-9175368288a1_1024x1536.png 848w, https://substackcdn.com/image/fetch/$s_!_1Lj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2353bd9f-abd1-423c-b45c-9175368288a1_1024x1536.png 1272w, https://substackcdn.com/image/fetch/$s_!_1Lj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2353bd9f-abd1-423c-b45c-9175368288a1_1024x1536.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The important part is that Trust Insights runs <strong>before</strong> the sensitive operation, while the app still has a chance to add friction or stop it.</p><p>Running an evaluation after a remote session has already started would make the result much less useful.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lBLx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b84c6d8-0495-49dc-84a6-6968ac63f953_1206x2622.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lBLx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b84c6d8-0495-49dc-84a6-6968ac63f953_1206x2622.png 424w, https://substackcdn.com/image/fetch/$s_!lBLx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b84c6d8-0495-49dc-84a6-6968ac63f953_1206x2622.png 848w, https://substackcdn.com/image/fetch/$s_!lBLx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b84c6d8-0495-49dc-84a6-6968ac63f953_1206x2622.png 1272w, https://substackcdn.com/image/fetch/$s_!lBLx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b84c6d8-0495-49dc-84a6-6968ac63f953_1206x2622.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!lBLx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b84c6d8-0495-49dc-84a6-6968ac63f953_1206x2622.png" width="420" height="913.1343283582089" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9b84c6d8-0495-49dc-84a6-6968ac63f953_1206x2622.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2622,&quot;width&quot;:1206,&quot;resizeWidth&quot;:420,&quot;bytes&quot;:146459,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/211332535?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b84c6d8-0495-49dc-84a6-6968ac63f953_1206x2622.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lBLx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b84c6d8-0495-49dc-84a6-6968ac63f953_1206x2622.png 424w, https://substackcdn.com/image/fetch/$s_!lBLx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b84c6d8-0495-49dc-84a6-6968ac63f953_1206x2622.png 848w, https://substackcdn.com/image/fetch/$s_!lBLx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b84c6d8-0495-49dc-84a6-6968ac63f953_1206x2622.png 1272w, https://substackcdn.com/image/fetch/$s_!lBLx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b84c6d8-0495-49dc-84a6-6968ac63f953_1206x2622.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Start of Session</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5Rgl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9c01a16-36c7-430f-8a78-543cc9603ab9_589x1280.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5Rgl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9c01a16-36c7-430f-8a78-543cc9603ab9_589x1280.jpeg 424w, https://substackcdn.com/image/fetch/$s_!5Rgl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9c01a16-36c7-430f-8a78-543cc9603ab9_589x1280.jpeg 848w, https://substackcdn.com/image/fetch/$s_!5Rgl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9c01a16-36c7-430f-8a78-543cc9603ab9_589x1280.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!5Rgl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9c01a16-36c7-430f-8a78-543cc9603ab9_589x1280.jpeg 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!5Rgl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9c01a16-36c7-430f-8a78-543cc9603ab9_589x1280.jpeg" width="419" height="910.5602716468591" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d9c01a16-36c7-430f-8a78-543cc9603ab9_589x1280.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1280,&quot;width&quot;:589,&quot;resizeWidth&quot;:419,&quot;bytes&quot;:32774,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/211332535?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9c01a16-36c7-430f-8a78-543cc9603ab9_589x1280.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5Rgl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9c01a16-36c7-430f-8a78-543cc9603ab9_589x1280.jpeg 424w, https://substackcdn.com/image/fetch/$s_!5Rgl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9c01a16-36c7-430f-8a78-543cc9603ab9_589x1280.jpeg 848w, https://substackcdn.com/image/fetch/$s_!5Rgl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9c01a16-36c7-430f-8a78-543cc9603ab9_589x1280.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!5Rgl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9c01a16-36c7-430f-8a78-543cc9603ab9_589x1280.jpeg 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">After Evaluation</figcaption></figure></div><div><hr></div><h2>Complete Project</h2><p>The <a href="https://gist.github.com/lanserxt/9488e5dbbb7eefaa68c30dc34646669c">complete SwiftUI sample</a> contains one public <code>TrustInsightsView</code> and <strong>don&#8217;t forget to add Capabilities</strong>!</p><div><hr></div><h2>Where To Use</h2><p>Trust Insights makes sense when the action itself can be completely legitimate but a person may be socially engineered into performing it.</p><p>The obvious examples are payments and transfers, but the categories make the framework useful beyond banking:</p><ul><li><p>changing account or recovery details</p></li><li><p>starting remote-support connections</p></li><li><p>granting access to expensive resources</p></li><li><p>bulk communication</p></li><li><p>creating connections to other people</p></li><li><p>purchases or transfers to unfamiliar recipients</p></li></ul><p>I wouldn&#8217;t request an insight on every button tap. Besides creating unnecessary friction and evaluation cost, the framework works best when the operation has a real social-engineering risk and the app has a meaningful response to <code>.medium</code> or <code>.high</code>.</p><p>If the product has no idea what it would do differently with the result, it probably doesn&#8217;t need an evaluation there.</p><div><hr></div><h2>Limitations</h2><p>There are several things I would keep in mind before integrating Trust Insights:</p><ul><li><p>The framework is currently beta.</p></li><li><p>It requires the Trust Insights entitlement.</p></li><li><p>User authorization is required before evaluations.</p></li><li><p>Evaluation can take several seconds because it includes on-device and server processing.</p></li><li><p>The first available insight is <code>IsLikelyBeingCoachedInsight</code>.</p></li><li><p>Coaching isn&#8217;t necessarily malicious.</p></li><li><p><code>.unknown</code> means no evidence of coaching, not &#8220;low risk.&#8221;</p></li><li><p>Overall evaluation errors and per-insight errors are separate.</p></li><li><p>Trust Insights should complement, not replace, your existing risk engine.</p></li><li><p>Server-side decisions should prefer the signed payload rather than trusting a client-parsed value.</p></li><li><p>Consumption feedback should reflect how the result actually affected the user flow.</p></li></ul><p>The API surface is quite small. The harder work is product design: deciding where an evaluation is justified and what &#8220;increased friction&#8221; should actually mean for your users.</p><div><hr></div><h2>References</h2><ul><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/trustinsights">Trust Insights</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/trustinsights/insightevaluator">InsightEvaluator</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/trustinsights/insightevaluator/insightcontext">InsightEvaluator.InsightContext</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/trustinsights/insightevaluator/authorizationstatus">InsightEvaluator.AuthorizationStatus</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/trustinsights/islikelybeingcoachedinsight">IsLikelyBeingCoachedInsight</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/trustinsights/insightevaluation">InsightEvaluation</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/trustinsights/insightevaluationconsumptionstatus">InsightEvaluationConsumptionStatus</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/bundleresources/entitlements/com.apple.developer.trustinsights.base">Trust Insights entitlement</a></p></li><li><p>Apple Video: <a href="https://developer.apple.com/videos/play/wwdc2026/379/">Meet Trust Insights</a></p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[iPhone Duo Photos & Camera Q&A - Forums]]></title><description><![CDATA[Direct answers from Apple Engineers]]></description><link>https://antongubarenko.substack.com/p/iphone-duo-photos-and-camera-q-and</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/iphone-duo-photos-and-camera-q-and</guid><dc:creator><![CDATA[Anton Gubarenko]]></dc:creator><pubDate>Thu, 01 Oct 2026 06:04:47 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/d10b2dee-6fef-4673-9594-c598fa2bca60_1254x1254.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Our next Forums session&#8230;</p><p>These activities focused on building camera experiences for iPhone Duo: the two front cameras, the Virtual Front Camera, camera-direction changes, ARKit, multi-camera capture, half-open layouts, reserved regions, accessory scenes, preview rotation, and real-time Vision processing.</p><p>As usual, the goal is simple: make the questions easier to scan, easier to revisit, and easier to connect with real app-development problems.</p><blockquote><p>I have preserved the intent of the original questions and condensed the replies for clarity. Most answers came from Apple engineers or evangelists. Where a thread contains only community discussion, a request for clarification, or an unresolved follow-up, that is called out explicitly.</p></blockquote><p>Enjoy!</p><div><hr></div><h2>Can the inner under-display camera drive real-time body-pose analysis?</h2><p>Yes. AVFoundation exposes the camera as <code>builtInInnerUltraWideCamera</code>. Its 1080p formats at 30 and 60 fps are native camera readouts rather than low-detail preview streams, and third-party apps can use the camera for long-running analysis sessions.</p><p>Create an <code>AVCaptureSession</code> with the inner camera, attach an <code>AVCaptureVideoDataOutput</code>, and process its sample buffers with <code>VNDetectHumanBodyPoseRequest</code>. For real-time processing, set <code>alwaysDiscardsLateVideoFrames</code> to <code>true</code>so expensive Vision work does not create a growing backlog. Use <code>AVCaptureDeviceDirectionCoordinator</code> to respond when opening or closing the device changes the direction a camera faces.</p><p><a href="https://developer.apple.com/forums/thread/847809">Forum thread</a></p><div><hr></div><h2>Can users assign different wallpapers to the inner and outer displays?</h2><p>Apple described wallpaper behavior as the same as on other iPhones: a person can set a Lock Screen wallpaper, a Home Screen wallpaper, or both as a pair.</p><p>The reply did not specify separate per-display images, independent focal points, or different crops for the inner and outer displays. Apple also noted that this is a consumer-support question rather than a developer-framework question.</p><p><a href="https://developer.apple.com/forums/thread/847768">Forum thread</a></p><div><hr></div><h2>Where should camera controls go in the half-open pose?</h2><p>Let the preview fill the available scene, then keep the shutter button and other controls clear of system overlays, display corners, camera housings, and the fold. Use safe-area insets, layout margins, and reserved-region queries for custom layouts. Framework-provided adaptive containers can avoid those regions automatically.</p><p>Keep controls concise and accessible, use familiar symbols, preserve at least a 44-by-44-point hit region, and avoid duplicating controls already exposed through system camera overlays. Use <code>AVCaptureDeviceDirectionCoordinator</code>when the physical direction of a selected camera can change with the pose. A camera app may also use <code>CameraCaptureAccessory</code> for complementary content on the outer display while capturing on the inner display.</p><p><a href="https://developer.apple.com/forums/thread/847715">Forum thread</a></p><div><hr></div><h2>What happens to the under-display camera while FaceTime continues in another app?</h2><p>The active under-display FaceTime camera remains visible over the foreground app. Switching apps does not hide the camera or make the other participant&#8217;s video unavailable.</p><p>The foreground app should query reserved regions and keep important content&#8212;such as navigation titles and controls&#8212;out of the active camera occlusion.</p><p><a href="https://developer.apple.com/forums/thread/847772">Forum thread</a></p><div><hr></div><h2>Can ARKit use both iPhone Duo displays?</h2><p>An active <code>ARSession</code> qualifies the app to use <code>CameraCaptureAccessory</code>, so an ARKit app can present complementary content on the other display while ARKit continues to run.</p><p>This does not create two full AR views. The primary AR experience belongs to the person looking at the main display: the inner display when open or the outer display when closed. With world tracking, the accessory display can show supporting content for another person facing the rear camera. With face tracking, the inner front camera supports the mirror-like experience for the person using the inner display.</p><p><a href="https://developer.apple.com/forums/thread/847744">Forum thread</a></p><div><hr></div><h2>How should a camera app design for the half-open pose?</h2><p>Prefer an arrangement view when the interface can be modeled as primary and secondary regions. It provides the recommended automatic adaptation across poses.</p><p>For a fully custom layout, query reserved regions and move the preview or controls around the active division and occlusions manually. This is the appropriate path when, for example, a preview should be centered while flat but occupy only the upper half when the device is partly folded.</p><p><a href="https://developer.apple.com/forums/thread/847752">Forum thread</a></p><div><hr></div><h2>How should a centered shutter button avoid the hinge?</h2><p>Use the active reserved-region geometry to detect the division and reposition the shutter button, camera-mode selector, and other centered controls away from it.</p><p>An arrangement view is the higher-level alternative when the screen naturally divides into two areas. It handles more of the pose-dependent positioning than a completely manual overlay.</p><p><a href="https://developer.apple.com/forums/thread/847757">Forum thread</a></p><div><hr></div><h2>What orientation does a <code>CameraCaptureAccessory</code> scene receive in laptop pose?</h2><p>This thread did not receive a definitive behavioral answer. The reported simulator presented the outer accessory scene in a portrait-sized 466-by-678-point layout during a partially folded pose, causing landscape content to be letterboxed.</p><p>Apple requested a Feedback Assistant report with a reproducing sample project so the behavior could be investigated. The thread therefore does not establish whether the simulator matches physical hardware or provide a supported way to derive a different physical orientation from the accessory scene.</p><p><a href="https://developer.apple.com/forums/thread/847762">Forum thread</a></p><div><hr></div><h2>Does folding interrupt an ARKit session?</h2><p>No. Folding or unfolding does not pause or interrupt <code>ARSession</code>.</p><p>With <code>ARWorldTrackingConfiguration</code>, tracking continues across the transition. With <code>ARFaceTrackingConfiguration</code>, ARKit automatically switches between the appropriate front cameras.</p><p><a href="https://developer.apple.com/forums/thread/847767">Forum thread</a></p><div><hr></div><h2>What quality and thermal behavior should apps expect from the inner camera?</h2><p>The inner under-display camera provides native 1080p at both 30 and 60 fps. It supports still images, video recording, video data output, and metadata output for tasks such as face, body, and QR-code detection. It is supported for long-running streaming sessions.</p><p>Because the sensor sits behind the display, the camera system performs extra per-frame processing to correct diffraction, flare, and similar artifacts. That processing is real-time and thermally sustainable at the supported frame rates. Images may contain somewhat more noise than the outer camera, so apps adding heavy Vision or ML processing should monitor frame drops and scale their work accordingly.</p><p><a href="https://developer.apple.com/forums/thread/847839">Forum thread</a></p><div><hr></div><h2>Is the Virtual Front Camera stream continuous while switching physical cameras?</h2><p>The Virtual Front Camera handles the physical-camera switch without interrupting the <code>AVCaptureSession</code>. The app should nevertheless expect dropped frames and a discontinuity in the timestamps of the <code>CMSampleBuffer</code> values delivered through <code>AVCaptureVideoDataOutput</code> during the handover.</p><p>Optical intrinsics and lens-distortion coefficients update as the active physical camera changes. The Virtual Front Camera can also be paired with a rear camera in <code>AVCaptureMultiCamSession</code>; use <code>supportedMultiCamDeviceSets</code> to discover valid combinations. At most three physical cameras can run together.</p><p><a href="https://developer.apple.com/forums/thread/847766">Forum thread</a></p><p><a href="https://developer.apple.com/forums/thread/848088">Additional forum thread</a></p><div><hr></div><h2>Can multiple front and rear cameras run simultaneously?</h2><p>Yes. Configure an <code>AVCaptureMultiCamSession</code> with compatible front and rear cameras. <code>AVCaptureDevice.DiscoverySession.supportedMultiCamDeviceSets</code> reports combinations that can include three physical cameras running at the same time.</p><p>Because a camera&#8217;s effective direction can change with the device pose, use <code>AVCaptureDeviceDirectionCoordinator</code> to determine how each selected camera currently faces.</p><p><a href="https://developer.apple.com/forums/thread/847763">Forum thread</a></p><div><hr></div><h2>Can constituent photo delivery combine an outer front camera and a rear camera?</h2><p>No. iPhone Duo does not expose a virtual <code>AVCaptureDevice</code> whose constituent devices combine a rear camera with the outer front ultra-wide camera.</p><p>Use <code>AVCaptureMultiCamSession</code> when the app needs simultaneous access to front and rear cameras. That is separate from virtual-device constituent photo delivery.</p><p><a href="https://developer.apple.com/forums/thread/847781">Forum thread</a></p><div><hr></div><h2>How are the cameras positioned for landscape capture?</h2><p>When the inner display is landscape, its front-facing under-display camera sits on the right half, roughly between the crease and the outer edge. That camera supports up to 60 fps, so an experience that depends on a 120-fps front feed cannot use it unchanged.</p><p>When the phone is flipped, rear cameras or the outer front camera may face the user depending on the physical setup. The outer display normally presents portrait content; using it in landscape requires an unusual posture such as placing the partly folded device like a laptop on its camera bump. The thread advises designing around realistic device placement rather than assuming the previous single-screen camera geometry remains available.</p><p><a href="https://developer.apple.com/forums/thread/847748">Forum thread</a></p><div><hr></div><h2>Is dual capture available in every fold state?</h2><p>The inner built-in ultra-wide camera is unavailable while the inner display is closed. Other supported cameras remain available according to the current configuration.</p><p>Do not infer camera availability directly from hinge state. Ask <code>AVCaptureDeviceDirectionCoordinator</code> which cameras are available for the relevant view. That keeps capture behavior aligned with scene movement and camera direction instead of hard-coding pose checks.</p><p><a href="https://developer.apple.com/forums/thread/847754">Forum thread</a></p><div><hr></div><h2>Can a camera app keep its entire interface at a fixed orientation?</h2><p>For camera preview and captured-media rotation, Apple recommends adopting <code>AVCaptureDevice.RotationCoordinator</code>. It helps manage previews and photos across iPhone Duo&#8217;s poses and orientations.</p><p>The question also requested a way to keep the entire interface fixed relative to the hardware so toolbars never relocate during rotation. The reply did not provide such an API, and the author noted that rotation coordination does not solve that broader interface-layout requirement. That part of the request remains unresolved.</p><p><a href="https://developer.apple.com/forums/thread/847755">Forum thread</a></p><div><hr></div><h2>How should camera workflows be tested when the Duo simulator has no camera devices?</h2><p>Apple did not announce plans for synthetic camera devices in the simulator and recommended filing an enhancement request through Feedback Assistant.</p><p>Use the simulator to validate general UI flow, adaptive layout, and preview-container behavior, but test the real capture pipeline on physical devices. Camera availability, throughput, thermal behavior, dropped frames, and other real-time performance characteristics vary by device, so simulator or mock-feed success cannot validate production capture performance.</p><p><a href="https://developer.apple.com/forums/thread/848083">Forum thread</a></p><div><hr></div><h2>Acknowledgments</h2><p>A huge thank-you to everyone who asked practical camera and media questions during the iPhone Duo activities, and to the Apple media, frameworks, vision, and developer-support engineers who replied.</p><p>The original activities and all source discussions are available on the Apple Developer Forums: <a href="https://developer.apple.com/forums/activities/1659080">September 23</a> and <a href="https://developer.apple.com/forums/activities/1673080">September 24</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[iPhone Duo UIKit Q&A - Forums]]></title><description><![CDATA[Direct answers from Apple Engineers]]></description><link>https://antongubarenko.substack.com/p/iphone-duo-uikit-q-and-a-forums</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/iphone-duo-uikit-q-and-a-forums</guid><dc:creator><![CDATA[Anton Gubarenko]]></dc:creator><pubDate>Wed, 30 Sep 2026 04:57:50 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/93ad765a-7477-425c-8ff8-3ec87ebf0777_1254x1254.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Our Forums story goes on&#8230;</p><p>These activities focused on adapting UIKit apps to iPhone Duo: size classes, trait collections, asymmetric safe areas, reserved regions, modal placement, tab bars, custom navigation controls, collection-view layouts, scene lifecycle, compatibility modes, rotation, hinge updates, web views, and state preservation.</p><p>As usual, the goal is simple: make the questions easier to scan, easier to revisit, and easier to connect with real app-development problems.</p><blockquote><p>I have preserved the intent of the original questions and condensed the replies for clarity. Most answers came from Apple engineers or evangelists. Where a thread contains only community discussion, a request for clarification, or an unresolved follow-up, that is called out explicitly.</p></blockquote><p>Enjoy!</p><div><hr></div><h2>Can <code>preferredVerticalBarBehavior</code> change with the horizontal size class?</h2><p>Treat <code>preferredVerticalBarBehavior</code> as a stable choice. Do not repeatedly toggle it as users navigate or use it to hide bars for the state of one view controller; use the visibility APIs for that.</p><p>Disabling the vertical bar can still be appropriate when a regular-width layout genuinely benefits from a different bar arrangement. Safari is an example because its dynamic tabs use the additional horizontal space. Most apps should retain the adaptive system behavior unless their regular-width experience has a similarly strong reason to diverge.</p><p><a href="https://developer.apple.com/forums/thread/847864">Forum thread</a></p><div><hr></div><h2>Can a sheet be centered when flat but placed on the trailing side when folded?</h2><p>There is no placement-preference order such as centered, then trailing, then leading. The sheet presentation controller&#8217;s placement applies across configurations rather than only in the folded pose.</p><p>Apple recommended filing an enhancement request for a pose-dependent placement API. As a workaround, query the reserved regions, detect whether a division region is active, and update the placement based on that state.</p><p><a href="https://developer.apple.com/forums/thread/847797">Forum thread</a></p><div><hr></div><h2>Is <code>UIScreen.main.bounds</code> valid for iPhone Duo layout?</h2><p>Use the most local layout information available. A window scene&#8217;s bounds are more relevant than <code>UIScreen.main.bounds</code>, but a specific view&#8217;s bounds, safe area, and layout environment are better still.</p><p>Layouts should derive their dimensions from the view hierarchy that is actually being arranged. This avoids assumptions about which physical display or window currently contains the interface.</p><p><a href="https://developer.apple.com/forums/thread/847909">Forum thread</a></p><div><hr></div><h2>How can an app detect that it is running on iPhone Duo?</h2><p>There is no API for identifying iPhone Duo as a device model. Apple recommends designing from the available size, traits, and reserved regions rather than introducing device-specific branches.</p><p>An iPhone Duo app is still an iPhone app, and resizable iPhone interfaces now appear in other contexts as well, including iPad and iPhone Mirroring. Query the capabilities and constraints needed by the layout instead of checking the hardware name or screen dimensions.</p><p><a href="https://developer.apple.com/forums/thread/847775">Forum thread</a></p><div><hr></div><h2>How should a custom vertical bar reserve and locate its space?</h2><p>In UIKit, read <code>verticalBarEdge</code> from the trait collection to learn which edge contains the vertical system bar. Use <code>UIView.LayoutRegion.bar(onEdge:extent:)</code> with APIs such as <code>UIView.layoutGuide(for:)</code> when positioning a custom bar.</p><p>Custom bars also need to reproduce the accessibility behavior users expect from system bars. That includes expanded labels on long press, overflow behavior, and Large Content Viewer support at accessibility text sizes. Using the system tab and toolbar APIs remains the preferred path when possible.</p><p><a href="https://developer.apple.com/forums/thread/847835">Forum thread</a></p><div><hr></div><h2>How should a compositional collection-view layout react to the fold?</h2><p><code>UICollectionView</code> and <code>UICollectionViewCompositionalLayout</code> do not automatically avoid the division region. If content scrolls across the fold, it may not need to avoid that region at all.</p><p>For a section that does not scroll orthogonally to the fold axis and must keep content away from the division, query the collection view&#8217;s reserved regions and adjust the compositional layout manually. System containers such as <code>UISplitViewController</code> provide more automatic book-pose behavior by adjusting column widths and margins.</p><p><a href="https://developer.apple.com/forums/thread/847879">Forum thread</a></p><div><hr></div><h2>How should a custom navigation-back item move into the vertical bar?</h2><p>If the customization only changes the back icon, set the navigation bar&#8217;s <code>backIndicatorImage</code> and preserve the system back-button behavior.</p><p>For a truly custom back item, set the toolbar item&#8217;s <code>axisBehavior</code> to <code>.verticalPreferred</code>. This tells the system that the item can participate in the vertical presentation rather than remaining fixed at the top-leading position.</p><p><a href="https://developer.apple.com/forums/thread/847875">Forum thread</a></p><div><hr></div><h2>Can a segmented control become a vertical toolbar item?</h2><p>A segmented control is not considered a good candidate for the vertical bar. Items in that bar should generally be glyph-based controls that can flow into an overflow menu when space is constrained.</p><p>The follow-up asked whether a group of always-visible glyphs could reproduce mutually exclusive segmented selection, but the thread did not provide a supported implementation for that design.</p><p><a href="https://developer.apple.com/forums/thread/847811">Forum thread</a></p><div><hr></div><h2>How should <code>UITabBarController.Mode.tabSidebar</code> behave on iPhone Duo?</h2><p>The system chooses between a regular tab bar and an adaptable sidebar based on context, orientation, and pose. iOS generally retains a bottom tab bar rather than adapting to a sidebar exactly as iPadOS does.</p><p>To request a sidebar on the inner display, set the tab bar controller&#8217;s preferred placement to sidebar. The thread author observed <code>sidebarOnly</code> tabs appearing unexpectedly and filed feedback, so that specific behavior may have been a beta issue rather than intended API behavior.</p><p><a href="https://developer.apple.com/forums/thread/847770">Forum thread</a></p><div><hr></div><h2>How can an existing app preview compatibility mode across iPhone Duo poses?</h2><p>Use the iPhone Duo simulator included with the iOS 27.1 SDK beta. It can show how an app built with an older SDK appears in compatibility mode.</p><p>The reply pointed developers to the broader preparation guidance for understanding compatibility presentations and the work required to become fully adaptive.</p><p><a href="https://developer.apple.com/forums/thread/847860">Forum thread</a></p><div><hr></div><h2>Must an app support iPad resizing when it supports iPhone Duo?</h2><p>This thread did not reach a definitive answer for the reported behavior. The app resized on Duo and through iPhone Mirroring but remained fixed in an iPhone presentation on iPad when built with one beta configuration.</p><p>Apple asked whether the target supported only the iPhone idiom and whether <code>UIRequiresFullScreen</code> was present. The author confirmed an iPhone-only target and no full-screen requirement, but the difference between the Xcode versions remained unresolved in the thread.</p><p><a href="https://developer.apple.com/forums/thread/847881">Forum thread</a></p><div><hr></div><h2>Can a tab bar be forced to use the vertical axis in every pose?</h2><p>No. A horizontal tab bar on the portrait inner display is expected behavior. UIKit applies system heuristics to choose the tab bar&#8217;s axis and location for the current context.</p><p>Do not assume that iPhone Duo always produces a vertical tab bar, and do not build the surrounding layout around that assumption.</p><p><a href="https://developer.apple.com/forums/thread/847817">Forum thread</a></p><div><hr></div><h2>How should <code>UITabAccessory</code> adapt when the device is partially folded?</h2><p>Use the active division reserved region to determine where the accessory can fit and whether it should move toward the left or right side.</p><p>The reply did not identify a dedicated <code>UITabAccessory</code> positioning API for this pose. The reserved-region geometry is the input the app should use for its layout decision.</p><p><a href="https://developer.apple.com/forums/thread/847814">Forum thread</a></p><div><hr></div><h2>How should a UIKit control move away from the center fold?</h2><p>Query the division reserved region and evaluate its frame. Its shape tells you the fold orientation: a taller-than-wide rectangle is vertical, while a wider-than-tall rectangle is horizontal. Use that geometry to decide which way the control should move.</p><p>UIKit does not provide an automatic layout guide for arbitrary fold avoidance. Reserved regions are the manual-layout API. Prefer <code>UIArrangementViewController</code> where its primary-and-secondary model fits, because it performs this evaluation automatically.</p><p><a href="https://developer.apple.com/forums/thread/847854">Forum thread</a></p><div><hr></div><h2>Can an iPhone-only app support Duo but opt out of free-form iPad resizing?</h2><p>No. Modern iPhone apps are expected to resize not only on iPhone Duo, but also when running on iPad and through iPhone Mirroring.</p><p>The adaptation work should therefore target flexible scene sizes rather than treat Duo support as an isolated device-specific mode.</p><p><a href="https://developer.apple.com/forums/thread/847872">Forum thread</a></p><div><hr></div><h2>Does the inner display use a regular horizontal size class?</h2><p>Yes, a full-width inner-display layout can report a regular horizontal size class, while a compact configuration reports compact. Size classes are the supported basis for layout adaptation.</p><p>Do not use them as a proxy for identifying a physical screen. Think about the space available to the scene, including cases where two apps share the inner display, and make the layout work for that size.</p><p><a href="https://developer.apple.com/forums/thread/847903">Forum thread</a></p><div><hr></div><h2>Can a modal fill the entire inner display?</h2><p>Set <code>modalPresentationStyle</code> to <code>.fullScreen</code> in UIKit. The corresponding SwiftUI presentation is <code>fullScreenCover</code>.</p><p>Full screen means the app&#8217;s current window scene. If the app is sharing the display with another app, the modal fills only its own scene and does not cover the entire physical inner display.</p><p><a href="https://developer.apple.com/forums/thread/847874">Forum thread</a></p><div><hr></div><h2>Why do some buttons move into the vertical bar while others remain horizontal?</h2><p>The reply directed developers to Apple&#8217;s vertical-bar design guidance but did not enumerate the exact priorities or properties used by the system&#8217;s placement heuristics.</p><p>Treat bar placement as adaptive system behavior. Use supported toolbar items and axis behaviors, ensure controls can tolerate overflow, and avoid depending on a particular item always occupying one axis.</p><p><a href="https://developer.apple.com/forums/thread/847898">Forum thread</a></p><div><hr></div><h2>What happens when an app has not yet adopted the new Duo APIs?</h2><p>An app built with Xcode 26 or an older SDK runs in compatibility mode. It keeps a familiar iPhone size and aspect ratio: on the outer display it occupies the area outside the vertical bar; when fully open it is centered; when partially open it shifts to one side; and in split-screen multitasking it retains that size on either side.</p><p>Adopting iPhone Duo begins with flexible layouts and size-class adaptation. APIs such as arrangement views and reserved regions come afterward and are needed only where they improve the app&#8217;s particular interface.</p><p><a href="https://developer.apple.com/forums/thread/847887">Forum thread</a></p><div><hr></div><h2>What happens to an <code>AppDelegate</code>-only app without scene lifecycle support?</h2><p>When built with an SDK earlier than iOS 27, the app runs on iPhone Duo in compatibility mode. Once rebuilt with Xcode 27, the scene-based lifecycle is required; this requirement is not exclusive to iPhone Duo.</p><p>Before moving to the newer SDK, migrate the UIKit app to <code>UIScene</code> and <code>SceneDelegate</code> using Apple&#8217;s scene-lifecycle guidance.</p><p><a href="https://developer.apple.com/forums/thread/847769">Forum thread</a></p><div><hr></div><h2>How can UIKit know when active reserved regions change?</h2><p>Call <code>reservedRegions(kind:options:)</code> on the relevant <code>UIView</code> to query division and occlusion frames. Re-evaluate those regions as UIKit updates traits, layout, and display; observation-tracking APIs can help connect this work to view updates.</p><p>For direct hinge-state updates, add <code>UIHingeInteraction</code> to the view hierarchy. Its handler receives updates such as closed, partially open, and fully open. Reserved regions describe the geometry to avoid, while hinge interaction describes the device&#8217;s physical state.</p><p><a href="https://developer.apple.com/forums/thread/847876">Forum thread</a></p><div><hr></div><h2>Can an app prevent rotation on iPhone Duo?</h2><p>The outer display respects supported interface orientations like other iPhones. If the app does not support a particular orientation, the outer-display scene is not rotated into it.</p><p>The inner display behaves differently and does not honor the app&#8217;s supported-interface-orientation restrictions. Do not use orientation as the basis for layout decisions there; use size classes and the actual available geometry instead.</p><p><a href="https://developer.apple.com/forums/thread/847851">Forum thread</a></p><div><hr></div><h2>Can an Xcode 27 build request the older black-bar compatibility mode?</h2><p>No. Compatibility presentation is selected from the SDK used to build the app, not from an <code>Info.plist</code> key.</p><p>An Xcode 26 build keeps the familiar fixed size and aspect ratio. An Xcode 27 build expands across most of the available screen but stays outside the vertical bar. An Xcode 27.1 build fills the complete scene and participates in the vertical bar.</p><p><a href="https://developer.apple.com/forums/thread/847856">Forum thread</a></p><div><hr></div><h2>Will an existing mixed UIKit and SwiftUI app run without <code>SceneDelegate</code>?</h2><p>This thread contains conflicting community replies: one says the app crashes while loading its first interface, while another says it runs in a boxed compatibility layout. It does not contain an authoritative Apple response.</p><p>The related Apple-answered discussion provides the useful distinction: builds made with an SDK before iOS 27 run in compatibility mode, while rebuilding with Xcode 27 requires adoption of the scene-based lifecycle. Plan the migration before moving the project to the newer SDK.</p><p><a href="https://developer.apple.com/forums/thread/847791">Forum thread</a></p><div><hr></div><h2>Should <code>UIArrangementViewController</code> replace an existing sidebar container?</h2><p>No. <code>UIArrangementViewController</code> is not a general-purpose navigation container, and a navigation controller should not be embedded inside one merely to reproduce a sidebar-and-content hierarchy.</p><p>For an existing <code>UISplitViewController</code> layout, keep using that container. A tab-bar controller can request sidebar placement with <code>tabBarController.sidebar.preferredPlacement = .sidebar</code>; the sidebar appears when the environment supports a regular horizontal size class.</p><p><a href="https://developer.apple.com/forums/thread/848000">Forum thread</a></p><div><hr></div><h2>How can custom UI determine which side of the division region it occupies?</h2><p>The community reply recommends querying <code>reservedRegions(kind:options:)</code>, inspecting the returned frames, and positioning custom views from that geometry.</p><p>The thread does not contain an Apple-confirmed semantic API for asking whether a view is on the leading or trailing display surface, so treat this as community guidance rather than an authoritative contract.</p><p><a href="https://developer.apple.com/forums/thread/848078">Forum thread</a></p><div><hr></div><h2>How should a large Objective-C document viewer adapt incrementally?</h2><p>Start with the scene&#8217;s actual size and existing adaptive-layout machinery. Fold and unfold transitions arrive through the same resizing and trait mechanisms used elsewhere, so avoid building a parallel device-configuration architecture. Built-in containers are the first choice; a two-page spread is a strong candidate for an arrangement-based layout, while reserved regions are appropriate for individually positioned controls.</p><p>The APIs are available from Objective-C, which makes incremental adoption practical. Move away from deprecated trait-change callbacks as the surrounding code is modernized. Existing external-display support can remain, while camera-oriented experiences should also evaluate the camera capture accessory APIs.</p><p><a href="https://developer.apple.com/forums/thread/848021">Forum thread</a></p><div><hr></div><h2>Is a payment-approval flow safe if the device folds mid-presentation?</h2><p>This thread did not receive a substantive answer. The only reply asks whether the first approval interface appeared, without addressing presentation ownership, duplicate callbacks, cancellation, or fold-time state handling.</p><p>The scenario therefore remains unresolved in this activity and should be validated directly against the payment framework being used.</p><p><a href="https://developer.apple.com/forums/thread/848056">Forum thread</a></p><div><hr></div><h2>Can a compositional-layout section be hidden by returning a <code>0.1</code>-point size?</h2><p>No. A tiny section is still a real section and can produce many tiny items; it is not a supported substitute for removing content from the data source or choosing a different layout structure.</p><p>The follow-up explains why the app wants size-class-dependent content, but the thread stops before establishing a complete recommended architecture. The clear takeaway is not to use a fake <code>0.1</code>-point section as a hiding mechanism.</p><p><a href="https://developer.apple.com/forums/thread/848018">Forum thread</a></p><div><hr></div><h2>Must a navigation-controller app be re-architected for iPhone Duo?</h2><p>No. <code>UINavigationController</code> continues to work, and there is no requirement to replace it. Adapt the navigation controller&#8217;s content for the available regular-width space just as you would on other resizable UIKit surfaces.</p><p>When a custom split or overlay is useful, <code>UIArrangementViewController</code> can be placed inside the existing navigation hierarchy rather than forcing a wholesale rewrite.</p><p><a href="https://developer.apple.com/forums/thread/848055">Forum thread</a></p><div><hr></div><h2>How should controls avoid asymmetric corners and system clusters?</h2><p>Use <code>UIView.LayoutRegion.margins(cornerAdaptation:)</code> when controls need margins that respond to the physical corners. For other system-occupied geometry, query <code>reservedRegions(kind:options:)</code> and incorporate the returned regions into layout.</p><p>This keeps the layout tied to the environment UIKit reports rather than to hard-coded device edges or assumed symmetry.</p><p><a href="https://developer.apple.com/forums/thread/848019">Forum thread</a></p><div><hr></div><h2>What should drive structural UIKit adaptation at runtime?</h2><p>Use the available size, size classes, and adaptive container behavior as the source of truth&#8212;not an iPhone Duo device check. Apps should already support resizing and every orientation their interface allows, including when running on iPad or through iPhone Mirroring.</p><p><code>UISplitViewController</code> automatically adapts to size-class and fold changes. For custom structures, choose containers and arrangements that respond to the environment instead of maintaining device-specific layout branches.</p><p><a href="https://developer.apple.com/forums/thread/848047">Forum thread</a></p><div><hr></div><h2>Should fold state be saved and restored through scene lifecycle events?</h2><p>Generally, no. Do not model the hinge as scene-level state that must be captured during backgrounding and restored on foreground entry. Reserved-region geometry is current when the scene returns, and adaptive containers or arrangement views update from the live layout environment.</p><p>For manually positioned elements, query reserved regions during layout and use observation tracking so changes trigger layout again. This also handles launching from a notification while the device is already folded without a special restoration path.</p><p><a href="https://developer.apple.com/forums/thread/848035">Forum thread</a></p><div><hr></div><h2>Should interactive component state survive a fold transition?</h2><p>The answer redirects to the carousel and cell-reuse discussion rather than defining separate rules. The practical guidance there is that a fold is a layout and trait transition, not a scene disconnection, so user state should generally persist while the interface adapts.</p><p>That still leaves component-specific behavior&#8212;such as pausing an in-flight animation or reconciling an interrupted gesture&#8212;to the app.</p><p><a href="https://developer.apple.com/forums/thread/848057">Forum thread</a></p><div><hr></div><h2>Does a fold reset carousel position or cell state?</h2><p>The system generally preserves text input and scroll position because folding changes the layout environment rather than disconnecting or terminating the scene. Apps typically should not add a manual scroll-position restoration path solely for a fold.</p><p>The reply does not individually guarantee every edge case listed in the question, including duplicate pagination, mid-swipe snapping, animation glitches, or memory leaks. Those behaviors still need normal identity, reuse, and transition testing in the app.</p><p><a href="https://developer.apple.com/forums/thread/848042">Forum thread</a></p><div><hr></div><h2>Do deep links need special handling during fold transitions?</h2><p>No. URL handling and external navigation should behave the same across iPhone models. A fold does not require Duo-specific verification or a separate deep-link code path.</p><p>Keep navigation state independent of the current geometry and let the destination interface adapt through the usual UIKit layout mechanisms.</p><p><a href="https://developer.apple.com/forums/thread/848040">Forum thread</a></p><div><hr></div><h2>Can an app automatically place itself beside FaceTime during a Group Activity?</h2><p>This thread contains only a brief community reply&#8212;&#8220;Two Apps Sharing the Screen&#8221;&#8212;and does not answer whether an API can automatically create that arrangement or control FaceTime placement.</p><p>Treat the API question as unresolved; the discussion does not establish supported behavior beyond the general concept of sharing the screen between apps.</p><p><a href="https://developer.apple.com/forums/thread/848038">Forum thread</a></p><div><hr></div><h2>Should custom view controllers detect a hinge through trait collections?</h2><p>There is no dedicated trait collection value representing hinge articulation. Prefer built-in containers when possible, use arrangement views or controllers for custom horizontal split and overlay layouts, and query reserved regions only for controls that require manual displacement.</p><p>Place the arrangement inside the app&#8217;s existing navigation container when that preserves the current hierarchy. The correct boundary depends on the layout, but it should remain view- and container-driven rather than becoming a global posture observer.</p><p><a href="https://developer.apple.com/forums/thread/848007">Forum thread</a></p><div><hr></div><h2>Are bottom sheets dismissed when the device folds?</h2><p>No. UIKit sheets remain presented and automatically adapt as the device moves between poses. They can be used while folded; the system adjusts their presentation rather than requiring the app to dismiss and recreate them.</p><p><a href="https://developer.apple.com/forums/thread/848034">Forum thread</a></p><div><hr></div><h2>How much control does an app have over sheet placement and sizing?</h2><p>Sheets automatically adapt to the way iPhone Duo is held. Use <code>UISheetPresentationController.preferredPlacement</code>to influence placement, and use the existing detent and sizing APIs for the sheet&#8217;s content.</p><p>Custom detents may be updated when traits change if the content genuinely needs different sizing. The reply identifies trait changes as the appropriate signal and recommends filing feedback when the existing sheet APIs cannot express the use case; there is no separate hinge-angle sheet API.</p><p><a href="https://developer.apple.com/forums/thread/848010">Forum thread</a></p><div><hr></div><h2>How can a <code>WKWebView</code> avoid the division region?</h2><p>For web content the app controls, query the geometry in the UIKit host and communicate it to the page. Web Platform Viewport Segments and Device Posture APIs can represent this information, but they are currently experimental Safari features and cannot be enabled in <code>WKWebView</code>.</p><p>CSS safe-area insets and the web view scroll view&#8217;s automatic inset adjustment do not account for the fold&#8217;s division reserved region, so avoid assuming they already include that spacing.</p><p><a href="https://developer.apple.com/forums/thread/848036">Forum thread</a></p><div><hr></div><h2>What should be reviewed when migrating from <code>AppDelegate</code> to scenes?</h2><p>Adopting the scene-based lifecycle is part of preparing a UIKit app for every available runtime size. Review scene lifecycle ownership, replace global assumptions about device and screen bounds with scene-local geometry, and follow UIKit&#8217;s scene-transition guidance.</p><p>Apple also recommends using Xcode&#8217;s app-resizability assistance to find outdated resizing and lifecycle patterns. Custom navigation and tab bars need hands-on validation because the thread cannot predict which assumptions in an individual implementation will break.</p><p><a href="https://developer.apple.com/forums/thread/848011">Forum thread</a></p><div><hr></div><h2>How do you set a split ratio on <code>UIArrangementViewController</code>?</h2><p>Create a split arrangement, copy its default view properties, set the preferred width of the primary region to a fractional dimension, write those properties back to the arrangement, and then update the controller:</p><pre><code><code>let controller = UIArrangementViewController(nibName: nil, bundle: nil)
var arrangement: UISplitArrangement = .split.axes(.horizontal)
var properties = arrangement.defaultViewProperties
properties.width.preferred = .fractional(0.33)
arrangement.setViewProperties(properties, for: .primary)
controller.updateArrangement(arrangement)</code></code></pre><p>This is the UIKit equivalent of expressing a preferred split ratio for the primary region.</p><p><a href="https://developer.apple.com/forums/thread/847990">Forum thread</a></p><div><hr></div><h2>Acknowledgments</h2><p>A huge thank-you to everyone who asked practical UIKit questions during the iPhone Duo activities, and to the Apple engineers, technology evangelists, and community members who replied.</p><p>The discussions covered trait-driven layouts, reserved regions, vertical bars, custom controls, collection views, scene lifecycle, compatibility modes, modal presentation, tab bars, rotation, resizing, web views, state preservation, and hinge observation.</p><p>The original activities and all source discussions are available on the Apple Developer Forums: <a href="https://developer.apple.com/forums/activities/1670080">September 23</a> and <a href="https://developer.apple.com/forums/activities/1665080">September 24</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[iPhone Duo SwiftUI Q&A - Forums]]></title><description><![CDATA[Direct answers from Apple Engineers]]></description><link>https://antongubarenko.substack.com/p/iphone-duo-swiftui-q-and-a-forums</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/iphone-duo-swiftui-q-and-a-forums</guid><dc:creator><![CDATA[Anton Gubarenko]]></dc:creator><pubDate>Tue, 29 Sep 2026 05:13:16 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/93ca768c-557f-44b6-8435-703fb40d8f99_1254x1254.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Apple is extending the range of direct Q&amp;A session. Once again. First we&#8217;ve got interactive panel session with live questions, then Group Labs with chat messages. And now we have interactive Forum session.</p><p>It&#8217;s totally new. I even didn&#8217;t got the whole flow from the registration link. It looks like a exclusive <a href="https://developer.apple.com/forums/topics/programming-languages-topic">Forums</a> page:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ym3t!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54c91a9e-fd5d-4a04-83d2-84cb407d07f8_1978x1308.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ym3t!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54c91a9e-fd5d-4a04-83d2-84cb407d07f8_1978x1308.png 424w, https://substackcdn.com/image/fetch/$s_!Ym3t!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54c91a9e-fd5d-4a04-83d2-84cb407d07f8_1978x1308.png 848w, https://substackcdn.com/image/fetch/$s_!Ym3t!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54c91a9e-fd5d-4a04-83d2-84cb407d07f8_1978x1308.png 1272w, https://substackcdn.com/image/fetch/$s_!Ym3t!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54c91a9e-fd5d-4a04-83d2-84cb407d07f8_1978x1308.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ym3t!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54c91a9e-fd5d-4a04-83d2-84cb407d07f8_1978x1308.png" width="1456" height="963" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/54c91a9e-fd5d-4a04-83d2-84cb407d07f8_1978x1308.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:963,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:231974,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/217300927?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54c91a9e-fd5d-4a04-83d2-84cb407d07f8_1978x1308.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Ym3t!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54c91a9e-fd5d-4a04-83d2-84cb407d07f8_1978x1308.png 424w, https://substackcdn.com/image/fetch/$s_!Ym3t!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54c91a9e-fd5d-4a04-83d2-84cb407d07f8_1978x1308.png 848w, https://substackcdn.com/image/fetch/$s_!Ym3t!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54c91a9e-fd5d-4a04-83d2-84cb407d07f8_1978x1308.png 1272w, https://substackcdn.com/image/fetch/$s_!Ym3t!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54c91a9e-fd5d-4a04-83d2-84cb407d07f8_1978x1308.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">iPhone Duo SwiftUI page</figcaption></figure></div><p>Developers posting the questions, other boost or can also reply to it. The most anticipated got an Apple Developer answer:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VLeQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea1c7dcc-c51c-4f5e-b725-c3d41a4d17ac_1766x832.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VLeQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea1c7dcc-c51c-4f5e-b725-c3d41a4d17ac_1766x832.png 424w, https://substackcdn.com/image/fetch/$s_!VLeQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea1c7dcc-c51c-4f5e-b725-c3d41a4d17ac_1766x832.png 848w, https://substackcdn.com/image/fetch/$s_!VLeQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea1c7dcc-c51c-4f5e-b725-c3d41a4d17ac_1766x832.png 1272w, https://substackcdn.com/image/fetch/$s_!VLeQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea1c7dcc-c51c-4f5e-b725-c3d41a4d17ac_1766x832.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VLeQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea1c7dcc-c51c-4f5e-b725-c3d41a4d17ac_1766x832.png" width="1456" height="686" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ea1c7dcc-c51c-4f5e-b725-c3d41a4d17ac_1766x832.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:686,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:159540,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/217300927?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea1c7dcc-c51c-4f5e-b725-c3d41a4d17ac_1766x832.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VLeQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea1c7dcc-c51c-4f5e-b725-c3d41a4d17ac_1766x832.png 424w, https://substackcdn.com/image/fetch/$s_!VLeQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea1c7dcc-c51c-4f5e-b725-c3d41a4d17ac_1766x832.png 848w, https://substackcdn.com/image/fetch/$s_!VLeQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea1c7dcc-c51c-4f5e-b725-c3d41a4d17ac_1766x832.png 1272w, https://substackcdn.com/image/fetch/$s_!VLeQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea1c7dcc-c51c-4f5e-b725-c3d41a4d17ac_1766x832.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Accepted answer</figcaption></figure></div><p>Well. I like this knowledge source also so without any delays have gathered questions with replies/answers for you.</p><p>There were 2 activities focused on building SwiftUI interfaces that adapt to iPhone Duo: fold-aware layouts, reserved regions, navigation, tab bars, multiple scenes, motion data, hinge-driven experiences, App Store preparation, and testing.</p><p>As usual, the goal is simple: make the questions easier to scan, easier to revisit, and easier to connect with real app-development problems.</p><blockquote><p>I have preserved the intent of the original questions and condensed the replies for clarity. Most answers came from Apple engineers or evangelists. Where a thread contains only community discussion, a request for clarification, or an unresolved follow-up, that is called out explicitly.</p></blockquote><p>Enjoy!</p><div><hr></div><h2>Can you answer a phone or FaceTime call while iPhone Duo is closed?</h2><p>Yes. Phone and FaceTime calls are expected to work like they do on other iPhones. A person can manage calls and interactions in both the closed and open states.</p><p>Apple also noted that general consumer questions are better directed to the Apple Support Community because this forum activity was intended for developer questions about frameworks and services.</p><p><a href="https://developer.apple.com/forums/thread/847813">Forum thread</a></p><div><hr></div><h2>How should a grid adapt around the fold in book mode?</h2><p>Use <code>LazyVGrid</code> or <code>LazyHGrid</code> inside a <code>ScrollView</code> when you need lazy loading, and use <code>Grid</code> with <code>GridRow</code> when the layout is fixed and you want more direct control over spacing and alignment.</p><p>Define the grid appropriate for each size class and configuration, then use reserved-region information to adjust spacing and alignment so items do not cross the fold. The reply did not describe a special grid API that automatically splits cells around the <code>.division</code> region; the layout still needs to account for that region.</p><p><a href="https://developer.apple.com/forums/thread/847826">Forum thread</a></p><div><hr></div><h2>Should a custom tab selector migrate to <code>TabView</code> on iPhone Duo?</h2><p>Prefer system containers such as <code>TabView</code> or <code>UITabBarController</code>. They automatically adapt their presentation, including moving navigation into a vertical bar when appropriate, while preserving system animation and touch behavior.</p><p>A custom control can participate in a vertical bar by placing it in a <code>ToolbarItem</code> and applying <code>.axisBehavior(.verticalPreferred)</code>. However, available height is determined dynamically. Five or six custom segments may be pushed into overflow or create poor touch targets, so a standard <code>TabView</code> or sidebar is the safer design.</p><p><a href="https://developer.apple.com/forums/thread/847798">Forum thread</a></p><div><hr></div><h2>What pattern should an iPhone <code>TabView</code> app use for a persistent sidebar?</h2><p>Use <code>NavigationSplitView</code> in SwiftUI or <code>UISplitViewController</code> in UIKit. These containers provide the correct semantics for hierarchical navigation, collapsing to a stack on compact displays and expanding into adjacent panes when more space becomes available.</p><p><code>ArrangementView</code> is intended to adapt a primary and secondary view to poses and reserved regions. It should not replace a navigation split view when the UI is fundamentally a sidebar-and-content hierarchy. Avoid nesting an arrangement inside a split view, list, or scroll view in a way that could make part of the arrangement inaccessible.</p><p><a href="https://developer.apple.com/forums/thread/847795">Forum thread</a></p><div><hr></div><h2>Must <code>GeometryReader</code> and <code>containerRelativeFrame</code> be replaced for iPhone Duo?</h2><p>No. Both APIs remain supported and useful for resizable interfaces. Prefer container-relative sizing over fixed dimensions so content can adapt as the window moves between displays or changes size.</p><p>Use <code>GeometryReader</code> to obtain a <code>GeometryProxy</code>, query reserved regions, and respond to active divisions and occlusions such as the fold or camera cutouts. For more advanced two-pane adaptation, consider <code>ArrangementView</code>, which can choose split or overlay presentations based on the available configuration.</p><p><a href="https://developer.apple.com/forums/thread/847833">Forum thread</a></p><div><hr></div><h2>How does <code>ArrangementView</code> behave across iPhone Duo display modes?</h2><p>Unlike <code>HStack</code> and <code>VStack</code>, <code>ArrangementView</code> is adaptive and is allowed to collapse to one child. When a split cannot be satisfied for the current aspect ratio, pose, or compact size class, it prioritizes the view with the higher <code>layoutPriority</code>, or the primary view by default.</p><p>Use <code>layoutPriority</code> to identify the essential child and read <code>@Environment(\.splitArrangementAxis)</code> to observe whether the split arrangement is active. The follow-up question&#8212;how to expose controls from a hidden secondary view&#8212;did not receive a complete Apple answer in this thread, so apps should ensure essential actions remain reachable in the compact presentation.</p><p><a href="https://developer.apple.com/forums/thread/847800">Forum thread</a></p><div><hr></div><h2>Can an app determine whether <code>ArrangementView</code> is displaying one or both children?</h2><p>This thread only received community replies. The suggested approach was to inspect <code>horizontalSizeClass</code>: treat <code>.regular</code> as the unfolded two-display case and <code>.compact</code> as the folded single-display case.</p><p>That can be a useful layout heuristic, but the thread does not establish it as an official or universal indicator of which <code>ArrangementView</code> children are currently visible. For the arrangement itself, <code>splitArrangementAxis</code> is the more directly relevant environment value when available.</p><p><a href="https://developer.apple.com/forums/thread/847953">Forum thread</a></p><div><hr></div><h2>Can an app remain half-width when built with the iOS 27.1 SDK?</h2><p>No. The expectation is that apps built with the current SDK are fully adaptive and can adjust to any scene size available at runtime. There is no API for opting into the older compatibility-sized presentation merely because an app has limited content.</p><p>Apps should design a useful expanded state rather than depending on a permanently narrow window. A community reply suggested using the secondary area for guidance or complementary content, but noted that this was not App Review guidance.</p><p><a href="https://developer.apple.com/forums/thread/847836">Forum thread</a></p><div><hr></div><h2>How should navigation state work for a linear flow across two displays?</h2><p>Model navigation independently from presentation. The logical path&#8212;such as moving from step 13 back to step 8&#8212;should remain stable while the interface changes between one pane, two panes, and different device poses.</p><p>Use system navigation containers such as <code>NavigationStack</code>, <code>NavigationSplitView</code>, <code>UINavigationController</code>, or <code>UISplitViewController</code>. Keeping the navigation model separate from the current layout prevents folding, unfolding, rotation, or resizing from resetting the user&#8217;s place.</p><p><a href="https://developer.apple.com/forums/thread/847818">Forum thread</a></p><div><hr></div><h2>Will the App Store identify apps optimized for iPhone Duo?</h2><p>The reply did not provide details about App Store badges, filters, editorial placement, or the exact criteria for being considered optimized.</p><p>For screenshots, Apple pointed to the App Store Connect screenshot specifications and said that support for uploading assets for this device would become available later in the year.</p><p><a href="https://developer.apple.com/forums/thread/847849">Forum thread</a></p><div><hr></div><h2>Can navigation-bar hiding on scroll be customized?</h2><p>Yes. In UIKit, use <code>UINavigationItem.navigationBarMinimization</code>. In SwiftUI, use <code>toolbarMinimizationBehavior(_:for:)</code>.</p><p>These APIs let the app control how the navigation bar minimizes during scrolling, including layouts presented on a folded iPhone Duo.</p><p><a href="https://developer.apple.com/forums/thread/847863">Forum thread</a></p><div><hr></div><h2>Can a Duo simulator be unfolded programmatically with <code>simctl</code> or XCTest?</h2><p>No supported solution was provided in this thread. The only reply was another developer asking Apple to expand <code>simctl</code>so simulator interactions and fold states can be driven through an official command-line interface.</p><p>For now, the thread documents a tooling gap rather than a confirmed automation technique.</p><p><a href="https://developer.apple.com/forums/thread/847883">Forum thread</a></p><div><hr></div><h2>How should <code>safeAreaBar</code> stay on one side of the fold?</h2><p>This thread did not reach a final answer. Apple asked for more detail about the intended behavior, and the author clarified that a bottom <code>safeAreaBar</code> should follow the primary side of an <code>ArrangementView</code> when the device is partially folded.</p><p>The examples showed that attaching the bar to the primary or secondary child did not fully express the desired behavior. No built-in equivalent to a &#8220;follow primary view&#8221; modifier was confirmed, so the question remains open.</p><p><a href="https://developer.apple.com/forums/thread/847790">Forum thread</a></p><div><hr></div><h2>Should security initialization run once per app or once per scene?</h2><p>Every app participates in iPhone Duo multitasking, but that does not mean every app must support multiple user-created scenes. If an app does support multiple windows, each window is a separate scene with its own <code>SceneDelegate</code> and lifecycle.</p><p>Choose the scope based on the security operation. Work that truly needs to happen once per process launch can observe the aggregate <code>UIApplication</code> lifecycle. Work that determines what a particular window may display belongs in that scene&#8217;s lifecycle. Shared security state should be coordinated at the app level when separate scenes must not diverge.</p><p><a href="https://developer.apple.com/forums/thread/847966">Forum thread</a></p><div><hr></div><h2>How should a confirmation dialog be presented from <code>ToolbarOverflowMenu</code>?</h2><p>The initial guidance was to use state-driven presentation: an action in <code>ToolbarOverflowMenu</code> updates shared state, and a <code>confirmationDialog</code> modifier elsewhere in the view hierarchy observes that state.</p><p>The author then clarified that the real issue is the source animation and anchor. UIKit exposes <code>overflowPresentationSource</code>, but the thread did not identify a SwiftUI equivalent that makes a confirmation dialog morph out of the overflow button. Whether an alert is the intended fallback remains unresolved in this discussion.</p><p><a href="https://developer.apple.com/forums/thread/847865">Forum thread</a></p><div><hr></div><h2>How should a real-time game consume hinge-angle updates?</h2><p>There is no guaranteed hinge update frequency or angle increment. Delivery depends on system conditions, so a game must not assume one update per frame or a fixed latency.</p><p>Using the values directly is appropriate for some effects. Other experiences may need smoothing, such as driving a spring animation toward the latest angle. The follow-up questions about the preferred UIKit/Metal observation API and measurement timestamps were not answered in this thread.</p><p><a href="https://developer.apple.com/forums/thread/847866">Forum thread</a></p><div><hr></div><h2>What guarantees does <code>onHingeChange</code> provide?</h2><p>There is no guaranteed update frequency, angle increment, range, or precision. Those details are controlled by the system and may vary.</p><p>The modifier is called with an initial context when the view enters a hierarchy that has hinge data. After that, apps should treat updates as state changes rather than as a fixed-rate animation clock.</p><p><a href="https://developer.apple.com/forums/thread/847765">Forum thread</a></p><div><hr></div><h2>Should horizontally scrolling content be clipped below a vertical tab bar?</h2><p>No. Seeing scrollable content beneath the translucent bar is expected. Do not manually clip it.</p><p>The system adds a safe-area inset on the relevant side, which becomes a content inset for the scroll view. This keeps every item reachable while allowing the visual material to continue beneath the bar.</p><p><a href="https://developer.apple.com/forums/thread/847821">Forum thread</a></p><div><hr></div><h2>What if only one split axis works for an <code>ArrangementView</code>?</h2><p>By default, a split arrangement chooses its axis from the container&#8217;s aspect ratio: horizontal when wider than tall and vertical when taller than wide.</p><p>If a vertical split does not work for the content, restrict the arrangement to horizontal splitting with <code>.arrangementViewStyle(.split.axes(.horizontal))</code>. In UIKit, use <code>updateArrangement(.split.axes(.horizontal))</code>. An overlay arrangement is another option: it can place the secondary view over the primary view in portrait and move them side by side across the fold when partially folded.</p><p><a href="https://developer.apple.com/forums/thread/847816">Forum thread</a></p><div><hr></div><h2>Is there an API that automatically moves content around reserved regions?</h2><p>For arbitrary content, the app generally reads the reserved regions and performs the necessary layout adjustment itself.</p><p>Some system containers, including <code>UISplitViewController</code>, account for these constraints. <code>ArrangementView</code> is the primary higher-level API for automatically adapting a primary and secondary view to reserved regions. A regular list does not gain equivalent fold-avoidance behavior automatically.</p><p><a href="https://developer.apple.com/forums/thread/847842">Forum thread</a></p><div><hr></div><h2>What is the best migration path from a custom tab bar?</h2><p>This thread contains community guidance rather than an official Apple answer. The main suggestion was to adopt <code>TabView</code> and represent a central action using a tab with <code>role: .prominent</code>.</p><p>The prominent item may move to a platform-appropriate position instead of remaining exactly centered. The discussion did not find a supported way to fully customize its tint or background. A visual workaround was proposed, but it relies on layout-specific padding and would need separate adaptation for iPhone Duo, so it should not be treated as system guidance.</p><p><a href="https://developer.apple.com/forums/thread/847810">Forum thread</a></p><div><hr></div><h2>Can a game make the hinge essential to its core mechanic?</h2><p>A hinge-dependent mechanic can be reasonable when it produces a purposeful game experience, even though general interface guidance discourages tying essential functionality to one pose.</p><p>Detect feature availability and provide a clear, graceful explanation on unsupported devices. Test multiple displays, sizes, orientations, poses, and physical hardware before submission. Apple did not guarantee App Review approval and recommended contacting App Review Support for a ruling on a specific game.</p><p><a href="https://developer.apple.com/forums/thread/847857">Forum thread</a></p><div><hr></div><h2>How should Core Motion coordinates follow the active display?</h2><p>Start processed motion updates with <code>startDeviceMotionUpdates(using:)</code>. Have the view conform to <code>CMBodyIdentifiable</code>, then assign that view to the motion manager&#8217;s <code>deviceMotionBody</code>.</p><p>The system transforms motion values to match the physical display containing the UI, whether it is the inner or outer display. <code>CMDeviceMotion.attitude</code> then arrives in the appropriate orientation. Body-relative orientation is available when the app is full screen on that display; otherwise, motion data uses the device&#8217;s default reference frame.</p><p><a href="https://developer.apple.com/forums/thread/847852">Forum thread</a></p><div><hr></div><h2>How should a blocking approval flow use both displays?</h2><p>Ordinary apps cannot simultaneously place their own scenes on both the inner and outer displays. That capability is limited to camera apps.</p><p>For a normal guided flow, design the approval state within the app&#8217;s current scene and available layout rather than assuming the status can occupy one physical display while supporting information appears on the other.</p><p><a href="https://developer.apple.com/forums/thread/847850">Forum thread</a></p><div><hr></div><h2>Can an app choose one side of the open display or customize unused space?</h2><p>Apps built with an older SDK may appear in a compatibility presentation that does not use the full screen. That system-provided surrounding area cannot be customized.</p><p>After building with the iOS 27.1 SDK, the app is expected to adapt to the full available scene size. There is no supported API for positioning the app&#8217;s scene specifically on the left or right side of the open device, nor for decorating the remaining system-owned area.</p><p><a href="https://developer.apple.com/forums/thread/847859">Forum thread</a></p><div><hr></div><h2>Can a guided approval flow put contextual content on the second display?</h2><p>Not for a general SwiftUI app. Simultaneous scenes across both displays are supported only for camera apps, which use the <code>CameraCaptureAccessory</code> API.</p><p>A non-camera approval flow should therefore adapt within its current scene instead of treating the other physical display as an independent presentation surface.</p><p><a href="https://developer.apple.com/forums/thread/847847">Forum thread</a></p><div><hr></div><h2>Is SwiftUI state preserved while moving between the outer and inner displays?</h2><p>Generally, yes. Hinge and display transitions are represented as size-class and trait changes, not as a scene disconnection or app termination. Text input and scroll position should normally survive the transition.</p><p>This also applies when a responsive layout changes a <code>LazyVGrid</code> column count while folding or unfolding. Apps typically do not need to introduce <code>scrollPosition(id:)</code> solely for this transition. The reply did not individually confirm every item in the question&#8212;such as sheets, popovers, focus, and camera sessions&#8212;so state-restoration-sensitive features should still be tested across all poses.</p><p><a href="https://developer.apple.com/forums/thread/847773">Forum thread</a></p><div><hr></div><h2>How can a custom SwiftUI form match the system&#8217;s asymmetric horizontal margins?</h2><p>The reported problem is that <code>Form</code> automatically accounts for the vertical bar, while a custom <code>ScrollView</code> and stack using <code>.scenePadding(.horizontal)</code> receive too much padding on whichever side contains the bar. The custom rows therefore cannot reproduce the system form&#8217;s asymmetric alignment.</p><p>Apple did not provide an equivalent to UIKit&#8217;s preserved superview layout margins. The behavior was reported as a missing SwiftUI capability under Feedback Assistant ID <code>FB24914585</code>, so this thread documents a framework gap rather than a supported workaround.</p><p><a href="https://developer.apple.com/forums/thread/848006">Forum thread</a></p><div><hr></div><h2>How can <code>ToolbarOverflowMenu</code> be visually separated from another Liquid Glass toolbar item?</h2><p>In the reported layout, <code>ToolbarSpacer(.fixed)</code> does not separate a regular <code>ToolbarItem</code> from <code>ToolbarOverflowMenu</code>; the plus and overflow buttons remain inside one shared Liquid Glass background.</p><p>No workaround was confirmed. Apple requested a feedback report, and the issue was filed as <code>FB24864715</code> and marked as a duplicate. The supplied screenshots and sample project were forwarded as useful evidence for the existing issue.</p><p><a href="https://developer.apple.com/forums/thread/848015">Forum thread</a></p><div><hr></div><h2>How does iPhone Duo adapt a portrait wallpaper to the inner landscape display?</h2><p>Apple redirected this question to its earlier wallpaper response: wallpaper behavior on iPhone Duo is intended to match other iPhones. A person can set a Lock Screen wallpaper, a Home Screen wallpaper, or the two as a pair.</p><p>The response did not document separate inner and outer images, independent crops, or guarantees about preserving a chosen focal point. Wallpaper apps should therefore avoid promising display-specific behavior that is not exposed through a developer API.</p><p><a href="https://developer.apple.com/forums/thread/848043">Forum thread</a></p><div><hr></div><h2>Why does <code>overlayArrangementZIndex</code> fail to distinguish arranged views on Duo?</h2><p>Apple confirmed that the observed behavior is a known bug. The expected way to determine whether the primary view is overlaid on the secondary view is to check whether <code>overlayArrangementZIndex</code> is greater than zero.</p><p>As a workaround, wrap the primary content in a container such as <code>VStack</code> before applying <code>.arrangementViewStyle(.overlay)</code> to the <code>ArrangementView</code>. The issue was filed as <code>FB24914700</code>.</p><p><a href="https://developer.apple.com/forums/thread/848029">Forum thread</a></p><div><hr></div><h2>Should fold and unfold layout changes be debounced across multiple layout passes?</h2><p>No general debounce sequence is recommended. Reserved regions, safe areas, and bounds should be treated as ordinary inputs to the declarative UI, with the current layout expressed as a function of their current values.</p><p>A person may pause or reverse direction while repositioning the device, so trying to predict an update order fights SwiftUI and can introduce bugs. Prefer higher-level adaptive containers when possible. If reserved regions are necessary, keep view identity and data flow stable rather than conditionally destroying and recreating stateful subtrees for transient intermediate geometry.</p><p><a href="https://developer.apple.com/forums/thread/848014">Forum thread</a></p><div><hr></div><h2>What is the preferred hierarchy for responding to the hinge in SwiftUI?</h2><p>Start with a standard system container such as <code>NavigationSplitView</code>. If that cannot express the design, try <code>ArrangementView</code>. Only when neither approach works should the layout manually query reserved regions and position content around them.</p><p>When using reserved regions, avoid changing the overall size in a way that repeatedly invalidates <code>GeometryReader</code> and causes another layout cycle. Test the result throughout the physical transition. <code>onHingeChange</code> is intended for hinge-driven behavior, not for making layout decisions.</p><p><a href="https://developer.apple.com/forums/thread/848017">Forum thread</a></p><div><hr></div><h2>Can an app deterministically distinguish the flat inner display from the outer display?</h2><p>No. There is intentionally no API for identifying whether a window is hosted on the inner or outer physical display, and safe-area signatures should not be used as a device-identification workaround.</p><p>Build the layout from the space and traits available to the immediate view. This produces an interface that also adapts correctly during multitasking, iPhone Mirroring, and execution on iPad. Duo-specific code should usually be limited to an arrangement view or reserved-region handling where the design genuinely needs it.</p><p><a href="https://developer.apple.com/forums/thread/847995">Forum thread</a></p><div><hr></div><h2>Will new SwiftUI views such as <code>ArrangementView</code> be backported?</h2><p>The response did not promise backporting. Treat these views like any other newly introduced API: guard them with standard availability checks and provide an appropriate alternative when the API is unavailable at runtime.</p><p>Apps that continue supporting older operating systems should therefore keep a fallback layout rather than assume the new containers will appear on those releases.</p><p><a href="https://developer.apple.com/forums/thread/848008">Forum thread</a></p><div><hr></div><h2>What <code>UIUserInterfaceIdiom</code> does iPhone Duo report?</h2><p>iPhone Duo reports <code>.phone</code>; it does not introduce a new idiom case.</p><p>Apple recommends auditing code that uses interface idiom to gate layout or functionality. Duo supports capabilities, including multiple scene instances, that older code may associate only with iPad. Prefer checking the actual trait, scene capability, and available geometry needed by the feature rather than assuming <code>.phone</code> describes a fixed set of behaviors.</p><p><a href="https://developer.apple.com/forums/thread/848023">Forum thread</a></p><div><hr></div><h2>Acknowledgments</h2><p>A huge thank-you to everyone who asked practical questions during the iPhone Duo SwiftUI activities, and to the Apple engineers, technology evangelists, and community members who replied.</p><p>The discussions covered adaptive grids, <code>ArrangementView</code>, navigation, tab bars, reserved regions, multiple scenes, security state, hinge input, Core Motion, simulator automation, App Store preparation, system margins, toolbar overflow behavior, API availability, and preserving interface state across display transitions.</p><p>The original activities and all source discussions are available on the Apple Developer Forums: <a href="https://developer.apple.com/forums/activities/1664080">September 23</a> and <a href="https://developer.apple.com/forums/activities/1671080">September 24</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[iPhone Duo Group Lab 2 - Q&A]]></title><description><![CDATA[Direct answers from Apple Engineers]]></description><link>https://antongubarenko.substack.com/p/iphone-duo-group-lab-2-q-and-a</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/iphone-duo-group-lab-2-q-and-a</guid><pubDate>Sat, 26 Sep 2026 04:48:04 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/45cf3c32-32dc-488a-829d-14c29229b05c_1254x1254.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Second Group Lab with the same topic. For those who missed: the first part. And sharing the general info. First part is <a href="https://antongubarenko.substack.com/p/iphone-duo-group-lab-q-and-a?r=21t43r&amp;utm_campaign=post&amp;utm_medium=web&amp;showWelcomeOnShare=true">here</a>.</p><p>This lab focused on adapting iPhone apps for iPhone Duo: responsive layouts, poses, the vertical bar, size classes, system components, resizability, accessibility, multi-window support, testing, and the new Xcode 27.1 tooling.</p><p>As usual, the goal is simple: make the questions easier to scan, easier to revisit, and easier to connect with real app development problems.</p><blockquote><p>I tried to preserve the original wording and combine related answers where appropriate. However, some inaccuracies or mismatches are still possible.</p></blockquote><p>Enjoy!</p><div><hr></div><h2>If an app is running full screen on the inner display and the user closes iPhone Duo, does it continue on the outer display or get backgrounded?</h2><p>It moves to the outer display and continues running. It feels like the app has simply gotten smaller.</p><p>With split view multitasking, the system tries to move the app the user was interacting with to the outer display and backgrounds the other app. If Duo is reopened relatively soon, both apps can return. If more time has passed, the app that was used on the outer display may take the whole inner display.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=188s">&#9201;&#65039; 3:08</a></p><div><hr></div><h2>When will Xcode 27.1 be available, and how can apps be tested for Duo before then?</h2><p>The release timing given was <strong>later this month</strong>.</p><p>Before Xcode 27.1 is available, run the app on iPad with window resizing enabled and test different window sizes. Use window scenes rather than assumptions based on the main screen. iPhone Mirroring is another option for an iPhone-only app.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=283s">&#9201;&#65039; 4:43</a></p><div><hr></div><h2>When iPhone Duo is partially folded in an L-shape, can an app receive touch input from both inner and outer displays at the same time?</h2><p>The answer given was <strong>no</strong>.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=347s">&#9201;&#65039; 5:47</a></p><div><hr></div><h2>If tab items use text labels instead of icons, are they supported in the vertical bar?</h2><p>A text-only tab can still move to the vertical layout, but the vertical tab bar normally shows the icon representation and reveals labels during interaction.</p><p>The design guidance given was to provide icons as well as text. SF Symbols was mentioned as a source of icons.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=407s">&#9201;&#65039; 6:47</a></p><div><hr></div><h2>How much should the UI differ between iPhone Duo landscape and iPad landscape?</h2><p>Start with the available space and size classes. Multi-column layouts and sidebars can appear in similar ways across devices with similar available space.</p><p>Then account for platform-specific differences. iPhone Duo is still a phone, so an iPad design may be a useful starting point, but parts that only make sense on iPad may need to be changed or guarded by idiom.</p><p>The Phone app was given as an example: on iPad the dialer is in a popover, while on Duo it is promoted to its own tab because Duo is a phone. Music mostly uses system behavior, with the sidebar being a major difference.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=592s">&#9201;&#65039; 9:52</a></p><div><hr></div><h2>Can apps use the inner screen in standing or tent mode like the glowing Alarm experience?</h2><p>The answer given was <strong>no</strong> for the general case. Having both displays on at the same time is generally associated with the camera accessory and camera apps.</p><p>Apps using AlarmKit get the glowing alarm behavior shown in the example.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=816s">&#9201;&#65039; 13:36</a></p><div><hr></div><h2>Is it possible to release an app that is only available for iPhone Duo?</h2><p>No definite App Store capability was given in the answer.</p><p>The discussion instead treated Duo as part of the iPhone lineup: an app should support the range of iPhones rather than require one Duo pose or Duo alone.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=880s">&#9201;&#65039; 14:40</a></p><div><hr></div><h2>Can iPad apps run directly on iPhone Duo in a compatibility mode?</h2><p>No definite compatibility-mode answer was given.</p><p>The suggested first step was to make the app universal and add iPhone to its supported platforms. An iPad app already supporting resizability can resize to dimensions similar to existing iPhones and several Duo poses.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=967s">&#9201;&#65039; 16:07</a></p><div><hr></div><h2>How should apps preserve navigation and UI state when switching between the inner and outer displays?</h2><p>With system navigation controllers, the app adapts as it is resized. It is not created on one display, torn down, and recreated on the other.</p><p>Music uses one Duo-specific behavior: opening the device can move Now Playing into lyrics mode because more space is available, and closing it returns to the non-lyrics layout.</p><p>In SwiftUI, switching between different container branches based on size class can cause state loss if the state has not been raised above those branches.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=1028s">&#9201;&#65039; 17:08</a></p><div><hr></div><h2>What should developers start looking into before the Duo simulator is available in Xcode 27.1?</h2><p>Make sure the app responds smoothly to resizing. iPad is one way to test this now, along with iPhone Mirroring.</p><p>Also test leading and trailing safe areas rather than assuming they are symmetrical or only checking top and bottom in a portrait-only app.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=1214s">&#9201;&#65039; 20:14</a></p><div><hr></div><h2>How should camera apps that fake auto-rotation adapt to iPhone Duo?</h2><p>Two Duo-specific camera APIs were discussed.</p><p><strong>AVCaptureDeviceRotationCoordinator</strong> can help determine the correct rotation for the camera view and UI.</p><p><strong>AVCaptureDeviceDirectionCoordinator</strong> can tell the app which direction the camera is facing. Duo has two front cameras, so an assumption that a &#8220;front&#8221; camera is always facing the user is not sufficient.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=1325s">&#9201;&#65039; 22:05</a></p><div><hr></div><h2>How can an app know whether Duo is in a pose such as laptop or book mode?</h2><p>System containers adapt automatically.</p><p>For custom layout behavior, <strong>arrangement views</strong> were suggested. They let the app describe views and their relationship while the system uses the current context to place them.</p><p>Music also uses the reserved region to know where the division is and arrange its layout when that region is active.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=1485s">&#9201;&#65039; 24:45</a></p><div><hr></div><h2>What was the biggest technical challenge when adapting system apps to iPhone Duo?</h2><p>For iTunes Store, the main work was modernizing legacy code: moving to window scenes and adopting Liquid Glass. After those changes, it worked on Duo without pose-specific code.</p><p>For FaceTime, work included deciding how people would take video calls, placing UI toward the inner camera, and keeping draggable self-view UI away from the camera when it is active.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=1730s">&#9201;&#65039; 28:50</a></p><div><hr></div><h2>In tent mode, how can an app put its main interface on the outside screen like Alarm?</h2><p>In tent mode, the main interface is on the outer display. For most apps, this is effectively the normal outer-display landscape layout propped up for glanceability.</p><p>The glowing inner-display behavior from Alarm is provided by AlarmKit.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=1875s">&#9201;&#65039; 31:15</a></p><div><hr></div><h2>Are there restrictions on animations or update rates for scene accessories on the outer display?</h2><p>No restriction was identified in the discussion.</p><p>FaceTime uses scene accessories to show video on both displays. A scene accessory is a full UI scene rather than something with widget-like content restrictions.</p><p>An active camera session is required to have both displays active.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=1939s">&#9201;&#65039; 32:19</a></p><div><hr></div><h2>In split view with two instances of the same app, can each instance have independent audio volume?</h2><p>No definite system-level answer was given.</p><p>The two windows are scenes of the same app, and the audio interface is separate from the UI. The discussion expected that the system would not provide two independent volume sliders. An app could potentially perform its own audio mixing through audio APIs.</p><p>The same multi-scene behavior can be tested on iPad.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=2008s">&#9201;&#65039; 33:28</a></p><div><hr></div><h2>How can important content stay away from the hinge without hard-coding Duo-specific dimensions?</h2><p>System components such as alerts already adapt their placement.</p><p>For custom content that can land in the fold &#8212; for example, a Buy Now or Start Free Trial button &#8212; use <strong>reserved regions</strong>. The app can detect when the fold region is active and move the element to the appropriate side.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=2085s">&#9201;&#65039; 34:45</a></p><div><hr></div><h2>How does iPhone Duo handle an external monitor? Does it support iPad-style Stage Manager multitasking?</h2><p>External-monitor support was said to work, although no detailed behavior was demonstrated during the session.</p><p>For iPad-style Stage Manager multitasking, the answer given was <strong>no</strong>.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=2176s">&#9201;&#65039; 36:16</a></p><div><hr></div><h2>Can an app control when its scene accessory appears on the outer display regardless of camera state?</h2><p>An active camera session is required for the scene accessory to become available.</p><p>While it is available, the app can toggle it on and off and observe its availability. Split view while Duo is open was given as another condition where a scene accessory may not be available.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=2240s">&#9201;&#65039; 37:20</a></p><div><hr></div><h2>How should apps handle asymmetric safe-area insets near the hinge?</h2><p>Do not assume the margins are the same on both sides.</p><p>SwiftUI has an API for applying the relevant margins, and UIKit has layout guides. Safe-area handling should account for all four edges.</p><p>For apps that do not want to respect the entire safe area, <strong>corner adaptation</strong> can be used to respect specific regions such as the camera or status bar while drawing elsewhere.</p><p>The outer display also has different corner radii, and Duo can use horizontal or vertical status-bar layouts depending on configuration.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=2369s">&#9201;&#65039; 39:29</a></p><div><hr></div><h2>Will developers be able to test apps on real iPhone Duo devices before release?</h2><p>The iPhone Duo page on the Apple Developer website was said to have a <strong>global workshops coming soon</strong> section. Developers were told to watch that space for upcoming workshops.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=2574s">&#9201;&#65039; 42:54</a></p><div><hr></div><h2>How can different hinge poses be tested in the Xcode simulator?</h2><p>Device Hub lets developers change the hinge angle and move the device through poses such as book, open, closed, laptop, and tent. The transition between poses can also be tested.</p><p>The simulator can represent the device in 3D as the hinge angle and orientation change.</p><p>It cannot simulate both displays being lit simultaneously for a camera app because simulator cameras are not available. In 27.1, camera apps can still launch in the simulator; the camera view simply has no camera content.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=2611s">&#9201;&#65039; 43:31</a></p><div><hr></div><h2>How do sheets with bottom controls, such as Find My, behave in landscape on the outer screen?</h2><p>Controls stay with the sheet. Whether the sheet uses vertical controls depends on the sheet and its content.</p><p>In the Find My example, portrait shows the tab bar on the side with a partially open sheet. After rotating, the tab bar moves to the bottom and the sheet moves to the leading side so it does not cover the map.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=2728s">&#9201;&#65039; 45:28</a></p><div><hr></div><h2>Will Xcode include a skill to help developers adapt apps for iPhone Duo?</h2><p>Yes. The modernization skill introduced in Xcode 27.0 is expanded in Xcode 27.1 with SwiftUI support and support for transitioning apps to iPhone Duo.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=2901s">&#9201;&#65039; 48:21</a></p><div><hr></div><h2>Can a custom tab bar behave like the system-provided tab bar on iPhone Duo?</h2><p>In general, no.</p><p>There is an API for obtaining the region where the system would place a bar, which can help position a custom implementation. But the behaviors of the native tab controller &#8212; including label presentation, lensing while scrubbing, compression, and overflow behavior &#8212; are not exposed as pieces that can simply be applied to a custom tab bar.</p><p>Using UITabBar, UIToolbar, or UINavigationBar alone does not make those bars switch to the vertical axis. The container controllers are required for that adaptation.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=2945s">&#9201;&#65039; 49:05</a></p><div><hr></div><h2>Does iPhone Duo have its own idiom?</h2><p>No. It uses the <strong>phone idiom</strong>.</p><p>Its inner display has a new phone size-class combination: <strong>regular / regular</strong>.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=3166s">&#9201;&#65039; 52:46</a></p><div><hr></div><h2>Which widget families and how many widgets are supported on the Duo lock screen?</h2><p>No complete answer was given.</p><p>Extra-large widgets are available on the inner display. The speakers expected that those would not fit on the outer display, but did not give a confirmed number of supported widgets.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=3228s">&#9201;&#65039; 53:48</a></p><div><hr></div><h2>Are there new iOS 27 APIs specifically for foldable layouts?</h2><p><strong>Arrangement views</strong> were highlighted. They can create layouts such as two-column arrangements and adapt those views as available space changes.</p><p>Arrangement views also work on other hardware. If the conditions for a two-column layout are met, they can show two columns; if not, they can move toward a single-view layout.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=3313s">&#9201;&#65039; 55:13</a></p><div><hr></div><h2>How can an app tell portrait from landscape on the outer display?</h2><p>The answer first questioned whether the distinction is needed. If it is, size can be checked. The outer display has different size classes across the two axes.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=3470s">&#9201;&#65039; 57:50</a></p><div><hr></div><h2>Can an app access the current Duo hinge angle?</h2><p>Yes. The hinge interaction provides the angle.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=3503s">&#9201;&#65039; 58:23</a></p><div><hr></div><h2>Can a web app check whether the device is specifically an iPhone Duo?</h2><p>Not specifically.</p><p>A standard web API can be used to determine whether a device has a fold and whether it is folded.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=3522s">&#9201;&#65039; 58:42</a></p><div><hr></div><h2>How can an app adopt Duo and iOS 27 APIs while still supporting older versions back to iOS 16?</h2><p>Use availability checks around APIs that require iOS 27.</p><p>The scope can depend on the app. Some apps may keep the old UI for older systems and build a new UI going forward. Others may keep features shared across OS versions and use smaller availability checks.</p><p>For arrangement views, an existing layout can remain the fallback and switch to arrangement views where the API is available.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=3548s">&#9201;&#65039; 59:08</a></p><div><hr></div><h2>Does iPhone Duo support multiple windows?</h2><p>Yes. The feature is called <strong>split view multitasking</strong>.</p><p><a href="https://www.youtube.com/watch?v=zAaPDbDKvaU&amp;t=3614s">&#9201;&#65039; 60:14</a></p><div><hr></div><h2>&#127942; Acknowledgments</h2><p>A huge thank-you to <strong>Anna, Luca, Ryan, and Maria</strong> for joining the session and answering questions.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[iPhone Duo Group Lab - Q&A]]></title><description><![CDATA[Direct answers from Apple Engineers]]></description><link>https://antongubarenko.substack.com/p/iphone-duo-group-lab-q-and-a</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/iphone-duo-group-lab-q-and-a</guid><dc:creator><![CDATA[Anton Gubarenko]]></dc:creator><pubDate>Fri, 25 Sep 2026 07:14:10 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/df087113-fa51-4982-9cb4-21d00e3992e5_1254x1254.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>It&#8217;s been a while since the last Q&amp;A session. Probably, it&#8217;s the first after WWDC and it&#8217;s the first related to our new iPhone.</p><p>This lab focused on adapting iPhone apps for iPhone Duo: responsive layouts, poses, the vertical bar, size classes, system components, resizability, accessibility, multi-window support, testing, and the new Xcode 27.1 tooling.</p><p>As usual, the goal is simple: make the questions easier to scan, easier to revisit, and easier to connect with real app development problems.</p><blockquote><p>I tried to preserve the original wording and combine related answers where appropriate. However, some inaccuracies or mismatches are still possible.</p></blockquote><p>Enjoy!</p><div><hr></div><h2>Can non-camera apps display content on the outer screen while iPhone Duo is unfolded?</h2><p>The companion outer display is available specifically to camera apps. The app needs the relevant system entitlement <strong>and an active camera session</strong>; the entitlement alone is not enough to light up the inner and outer displays together.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=211s">&#9201;&#65039; 3:31</a></p><div><hr></div><h2>Should iPhone Duo be treated as another adaptive size-class environment, or should apps build Duo-specific layouts?</h2><p>Start with adaptive layouts rather than a separate Duo-specific app design.</p><p>Existing adaptive-layout concepts from iPhone and iPad carry over to iPhone Duo. Built-in components such as split view controllers adapt automatically. There are also Duo-specific APIs for cases where the app wants to respond to poses or use the vertical controls.</p><p>The goal is for it to remain an iPhone experience as the device opens and provides more space.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=297s">&#9201;&#65039; 4:57</a></p><div><hr></div><h2>Can seated mode work with either side of iPhone Duo facing the table, and can an app detect which side is down?</h2><p>The device can be placed with either side facing the table.</p><p>For the question about detecting which display is physically facing the table, no specific API was identified in the discussion.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=591s">&#9201;&#65039; 9:51</a></p><div><hr></div><h2>Will a custom bottom tab bar automatically move into iPhone Duo&#8217;s vertical bar?</h2><p>Not if it is simply a custom <code>UITabBar</code> inserted into the view hierarchy.</p><p>Apps using <code>UITabBarController</code> or SwiftUI <code>TabView</code> get the system adaptation automatically. Fully custom bars require more work and may need lower-level APIs for alignment with vertical-bar metrics.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=742s">&#9201;&#65039; 12:22</a></p><div><hr></div><h2>What is one thing developers should adopt properly for the best iPhone Duo experience?</h2><p>The answers included:</p><ul><li><p>adopt the vertical bar and system navigation/tab components;</p></li><li><p>use arrangement views for pose-aware layouts;</p></li><li><p>account for the different ways people can hold and position the device;</p></li><li><p>use the highest-level API that fits the feature instead of starting from the raw hinge angle.</p></li></ul><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=971s">&#9201;&#65039; 16:11</a></p><div><hr></div><h2>How should existing apps adapt to Duo&#8217;s new aspect ratio and minimize letterboxing?</h2><p>Make the app resizable and test it at many sizes.</p><p>Resizable iPhone / iPhone Mirroring can be used to find layout issues early. Existing adaptive work such as size-class handling and removing assumptions such as <code>UIScreen.main</code> also applies.</p><p>There is also a deployment progression: apps built with Xcode 26 are letterboxed on the inner display; Xcode 27 with resizability uses more of the display; and Xcode 27.1 provides full iPhone Duo support.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=1278s">&#9201;&#65039; 21:18</a></p><div><hr></div><h2>Will Xcode provide coding-intelligence skills for modernizing apps for iPhone Duo?</h2><p>Yes. Xcode 27.1 will include an updated <strong>Modernize your app</strong> skill with iPhone Duo support and SwiftUI support in addition to UIKit.</p><p>The Maps team had already used this kind of assistance for modernization work such as replacing older screen-size assumptions.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=1520s">&#9201;&#65039; 25:20</a></p><div><hr></div><h2>What happens if an app supports portrait only when iPhone Duo unfolds?</h2><p>On the outer display, supported orientations are honored. On the inner display, the system does not keep the app constrained by those same orientation restrictions.</p><p>The inner display can become regular/regular. Size classes and the available space can be used to adapt the layout.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=1602s">&#9201;&#65039; 26:42</a></p><div><hr></div><h2>Are there accessibility considerations specific to iPhone Duo?</h2><p>The accessibility topics discussed included Dynamic Type, readable content guides, VoiceOver, Voice Control, and testing at the largest accessibility sizes.</p><p><strong>Reduce Transparency</strong> also changes the appearance behind the vertical bar, so the layout should be tested with that setting enabled.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=1734s">&#9201;&#65039; 28:54</a></p><div><hr></div><h2>Should developers think of iPhone Duo as one adaptable canvas or two cooperating displays?</h2><p>The discussion described the experience as a single app adapting as more space becomes available.</p><p>A task can begin with the device closed and continue after it opens. The TV app example was described as effectively stretching the window: when opened, it shows more content and additional details.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=1884s">&#9201;&#65039; 31:24</a></p><div><hr></div><h2>How should a three-column iPad layout adapt to iPhone Duo?</h2><p>System split-view components should do most of the work.</p><p>A three-column interface may show two columns at once, with the root/sidebar available as an overlay depending on orientation and available space. SwiftUI apps can use <code>NavigationSplitView</code>; UIKit apps can use <code>UISplitViewController</code>.</p><p>Using these system components also gives apps useful pose adaptations automatically, including resizing when the device is partially folded.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=2093s">&#9201;&#65039; 34:53</a></p><div><hr></div><h2>How are apps that have not yet adopted iPhone Duo presented?</h2><p>Apps linked against the older SDK remain in a compatibility presentation.</p><p>On the cover display, the panel described an iPhone-like aspect ratio with letterboxing. On the inner display, that same ratio is centered rather than automatically becoming a fully adaptive Duo experience.</p><p>Those apps also do not react to Duo-specific poses such as seated mode.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=2245s">&#9201;&#65039; 37:25</a></p><div><hr></div><h2>What Safari and WebKit APIs can web apps use for Duo poses and foldable layouts?</h2><p>Existing JavaScript standards for foldable devices were mentioned. No more specific WebKit API guidance was provided during the session.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=2328s">&#9201;&#65039; 38:48</a></p><div><hr></div><h2>Does every iPhone Duo pose need a custom layout?</h2><p>No. The discussion suggested starting with the adaptive layout rather than creating a separate design for every pose.</p><p>When a layout changes with the fold, transitions can help show the relationship between the previous and new arrangement.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=2392s">&#9201;&#65039; 39:52</a></p><div><hr></div><h2>Can apps use the inner and outer screens simultaneously?</h2><p>Yes, but the session described this as a camera-specific capability.</p><p>An app with an active camera session can present content on both displays. The example given was using the inner display for the camera experience while showing attention-grabbing content on the outer display for the person being photographed.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=2600s">&#9201;&#65039; 43:20</a></p><div><hr></div><h2>How should an app distinguish portrait and landscape layouts on the inner display?</h2><p>The current orientation is available in the environment/traits. The discussion also covered adapting from the actual space available to the app, including size classes, grids, and system container behavior.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=2657s">&#9201;&#65039; 44:17</a></p><div><hr></div><h2>Can an app built with Xcode 27 opt out of resizability until its Duo layout is ready?</h2><p>No. Once the app links against iOS 27, it gets iPhone resizability.</p><p>The answer also noted that an app does not need a perfect custom layout for every pose on day one. Resizability can provide the starting point, with Duo-specific APIs adopted afterward.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=2828s">&#9201;&#65039; 47:08</a></p><div><hr></div><h2>Should a sheet and tab bar that are visually connected on iPhone be separated on Duo?</h2><p>It depends on their semantic relationship.</p><p>Find My keeps the tab bar with the sheet because each tab selects the content shown inside that sheet. Separating them would disconnect controls that conceptually belong together.</p><p>For another app where a tab has its own sheet, separating the tab bar and sheet may make sense. In Find My, the tabs populate the sheet content, so keeping them together preserves that relationship.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=3062s">&#9201;&#65039; 51:02</a></p><div><hr></div><h2>What can developers test before the iPhone Duo simulator is available?</h2><p>Resizable iPhone / iPhone Mirroring can expose many ordinary layout problems before Duo-specific tooling arrives.</p><p>It is useful for finding hard-coded sizes, incorrect layout-guide usage, and assumptions that break when the window changes shape.</p><p>Duo-specific testing is still needed for features such as the vertical bar. Left and right safe-area or content insets should not be assumed to be equal.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=3207s">&#9201;&#65039; 53:27</a></p><div><hr></div><h2>Can an iPhone Duo app be full-screen only, for example for immersive AR?</h2><p>Yes. An app can hide the status bar and provide a full-screen experience just as on other iPhones.</p><p>The app does not have to use the vertical controls when they do not make sense for its experience.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=3363s">&#9201;&#65039; 56:03</a></p><div><hr></div><h2>What design mistake should developers avoid on iPhone Duo?</h2><p>The answer returned to the earlier point about trying to design for every pose and pulling back from that.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=3390s">&#9201;&#65039; 56:30</a></p><div><hr></div><h2>How do multiple instances of the same app work on iPhone Duo?</h2><p>They work similarly to existing multi-window app experiences: multiple views of the same app can be open at once, including side by side or paired with other apps.</p><p>If two instances use shared storage such as app storage, they share that underlying app state and use the normal SwiftUI/UIKit update mechanisms.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=3425s">&#9201;&#65039; 57:05</a></p><div><hr></div><h2>If two instances of the same app use AppStorage, do they share state?</h2><p>Yes. They are instances of the same app, so the underlying app storage is shared.</p><p>Normal SwiftUI or UIKit update mechanisms apply when that state changes.</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=3455s">&#9201;&#65039; 57:35</a></p><div><hr></div><h2>Is Core Motion&#8217;s reference frame tied to the Duo chassis or normalized to the active display?</h2><p>The answer was: &#8220;It&#8217;s magic; you don&#8217;t need to worry about it.&#8221;</p><p><a href="https://www.youtube.com/watch?v=0zp4gAgC6TI&amp;t=3481s">&#9201;&#65039; 58:01</a></p><div><hr></div><h2>&#127942; Acknowledgments</h2><p>A huge thank-you to everyone who joined this session.</p><p>The discussion covered adaptive layouts, size classes, the vertical bar, arrangement views, seated poses, system navigation components, accessibility, WebKit, resizability, compatibility behavior, testing, multi-window apps, and Core Motion.</p><p>Finally, thank you to <strong>Kurt, Tommy, Nate, Brandon, Nina, and Emanuel</strong> for sharing the framework, design, TV, Maps, Find My, and system-level perspectives behind iPhone Duo.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[SwiftUI Charts: Dynamic Masking]]></title><description><![CDATA[Masking the chart right]]></description><link>https://antongubarenko.substack.com/p/swiftui-charts-dynamic-masking</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/swiftui-charts-dynamic-masking</guid><dc:creator><![CDATA[Anton Gubarenko]]></dc:creator><pubDate>Tue, 22 Sep 2026 07:51:51 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/c047b967-d519-41ec-9fa7-517e27123487_1254x1254.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I&#8217;ve been working with charts for quite a long time...</p><p>Before SwiftUI Charts, most of us had two options: build something custom or bring in a large third-party library. Some of them were ports of popular Android charting libraries, others were fully custom UIKit solutions. They worked, but chart code could quickly become its own small project.</p><p>Then Apple introduced Swift Charts&#8230;</p><p>Of course, the first versions had limitations, but the API was immediately much friendlier. The declarative structure was straightforward, composition felt natural, and for a lot of regular product charts there was no reason to keep the old machinery around.</p><p>For one of my projects I built an activity chart with a request that sounded simple:</p><blockquote><p>Make the chart behave a little like TradingView: everything to the left of the selected point should stay at full opacity, while the part on the right should become dimmed.</p></blockquote><p>That was where things became interesting.</p><p>A regular SwiftUI view gives us tools like <code>trim</code>, but a chart mark isn&#8217;t just a <code>Shape</code> that we can trim to an arbitrary x-position. Rebuilding the dataset on every drag and rendering only the points before the selection worked conceptually, but it was too expensive and also changed the chart geometry while interacting.</p><p>I left the feature in the &#8220;there should be a better way&#8221; category. Then this year Natalia Panferova and Matthaus Woolard released <strong><a href="https://books.nilcoalescing.com/swift-charts-beyond-the-basics">Swift Charts Beyond the Basics</a></strong>. It goes much deeper into how Swift Charts actually composes and renders marks, along with a lot of techniques that aren&#8217;t obvious from the basic API surface.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ki9g!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca094bc-5240-4ecd-8bc3-e5ff5f58bf82_282x408.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ki9g!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca094bc-5240-4ecd-8bc3-e5ff5f58bf82_282x408.png 424w, https://substackcdn.com/image/fetch/$s_!ki9g!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca094bc-5240-4ecd-8bc3-e5ff5f58bf82_282x408.png 848w, https://substackcdn.com/image/fetch/$s_!ki9g!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca094bc-5240-4ecd-8bc3-e5ff5f58bf82_282x408.png 1272w, https://substackcdn.com/image/fetch/$s_!ki9g!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca094bc-5240-4ecd-8bc3-e5ff5f58bf82_282x408.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!ki9g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca094bc-5240-4ecd-8bc3-e5ff5f58bf82_282x408.png" width="232" height="335.6595744680851" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4ca094bc-5240-4ecd-8bc3-e5ff5f58bf82_282x408.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:408,&quot;width&quot;:282,&quot;resizeWidth&quot;:232,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Swift Charts Beyond the Basics by Natalia Panferova and Matthaus Woolard book cover&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Swift Charts Beyond the Basics by Natalia Panferova and Matthaus Woolard book cover" title="Swift Charts Beyond the Basics by Natalia Panferova and Matthaus Woolard book cover" srcset="https://substackcdn.com/image/fetch/$s_!ki9g!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca094bc-5240-4ecd-8bc3-e5ff5f58bf82_282x408.png 424w, https://substackcdn.com/image/fetch/$s_!ki9g!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca094bc-5240-4ecd-8bc3-e5ff5f58bf82_282x408.png 848w, https://substackcdn.com/image/fetch/$s_!ki9g!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca094bc-5240-4ecd-8bc3-e5ff5f58bf82_282x408.png 1272w, https://substackcdn.com/image/fetch/$s_!ki9g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ca094bc-5240-4ecd-8bc3-e5ff5f58bf82_282x408.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Great SwiftUI book</figcaption></figure></div><p>A big thank you to Natalia and Matthaus for the book. I really recommend it to anyone who works with Charts regularly. It pushed this feature out of the stuck state.</p><p>Let&#8217;s build it step by step.</p><div><hr></div><h2>Part 1: Start with a Plain Line Chart</h2><p>We&#8217;ll use a small activity dataset with a duration for each day.</p><p>Dataset:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;swift&quot;,&quot;nodeId&quot;:&quot;a9f35e21-4a98-464c-a679-4ed7315466df&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-swift">private struct DailyActivity: Identifiable {
    let id = UUID()
    let date: Date
    let duration: Int
    let temperature: Int
    
    var temperatureBand: TemperatureBand {
        TemperatureBand(temperature: temperature)
    }
    
    static let demoData: [DailyActivity] = [
        DailyActivity(date: Calendar.current.date(byAdding: .day, value: -6, to: .now) ?? .now, duration: 42, temperature: 7),
        DailyActivity(date: Calendar.current.date(byAdding: .day, value: -5, to: .now) ?? .now, duration: 68, temperature: 11),
        DailyActivity(date: Calendar.current.date(byAdding: .day, value: -4, to: .now) ?? .now, duration: 34, temperature: 4),
        DailyActivity(date: Calendar.current.date(byAdding: .day, value: -3, to: .now) ?? .now, duration: 91, temperature: 18),
        DailyActivity(date: Calendar.current.date(byAdding: .day, value: -2, to: .now) ?? .now, duration: 76, temperature: 22),
        DailyActivity(date: Calendar.current.date(byAdding: .day, value: -1, to: .now) ?? .now, duration: 57, temperature: 15),
        DailyActivity(date: .now, duration: 103, temperature: 27)
    ]
}

private enum TemperatureBand: String, CaseIterable {
    case cold = "Cold"
    case mild = "Mild"
    case warm = "Warm"
    case hot = "Hot"
    
    var color: Color {
        switch self {
        case .cold:
                .blue
        case .mild:
                .teal
        case .warm:
                .orange
        case .hot:
                .red
        }
    }
    
    init(temperature: Int) {
        switch temperature {
        case ..&lt;8:
            self = .cold
        case 8 ..&lt; 16:
            self = .mild
        case 16 ..&lt; 24:
            self = .warm
        default:
            self = .hot
        }
    }
}</code></pre></div><p>The initial chart is intentionally boring:</p><pre><code><code>LinePlot(
    dailyActivity,
    x: .value("Date", \.date),
    y: .value("Duration", \.duration)
)
.interpolationMethod(.catmullRom)
.foregroundStyle(lineGradient)
.lineStyle(StrokeStyle(lineWidth: 5))
.symbol(Circle())</code></code></pre><p>This gives us a smooth line with symbols on every data point.</p><p>The gradient is generated from the temperature associated with each activity, so the line can move through several color bands instead of using one static color.</p><pre><code><code>private var lineGradient: LinearGradient {
    let lastIndex = max(dailyActivity.count - 1, 1)

    let stops = dailyActivity.enumerated().map { index, activity in
        Gradient.Stop(
            color: activity.temperatureBand.color,
            location: CGFloat(index) / CGFloat(lastIndex)
        )
    }

    return LinearGradient(
        stops: stops,
        startPoint: .leading,
        endPoint: .trailing
    )
}</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!bmQ0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabf0faa4-8eca-4cce-9cd0-811f870134d1_804x686.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bmQ0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabf0faa4-8eca-4cce-9cd0-811f870134d1_804x686.png 424w, https://substackcdn.com/image/fetch/$s_!bmQ0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabf0faa4-8eca-4cce-9cd0-811f870134d1_804x686.png 848w, https://substackcdn.com/image/fetch/$s_!bmQ0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabf0faa4-8eca-4cce-9cd0-811f870134d1_804x686.png 1272w, https://substackcdn.com/image/fetch/$s_!bmQ0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabf0faa4-8eca-4cce-9cd0-811f870134d1_804x686.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!bmQ0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabf0faa4-8eca-4cce-9cd0-811f870134d1_804x686.png" width="440" height="375.4228855721393" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/abf0faa4-8eca-4cce-9cd0-811f870134d1_804x686.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:686,&quot;width&quot;:804,&quot;resizeWidth&quot;:440,&quot;bytes&quot;:80841,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/215470171?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabf0faa4-8eca-4cce-9cd0-811f870134d1_804x686.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!bmQ0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabf0faa4-8eca-4cce-9cd0-811f870134d1_804x686.png 424w, https://substackcdn.com/image/fetch/$s_!bmQ0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabf0faa4-8eca-4cce-9cd0-811f870134d1_804x686.png 848w, https://substackcdn.com/image/fetch/$s_!bmQ0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabf0faa4-8eca-4cce-9cd0-811f870134d1_804x686.png 1272w, https://substackcdn.com/image/fetch/$s_!bmQ0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fabf0faa4-8eca-4cce-9cd0-811f870134d1_804x686.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Line chart</figcaption></figure></div><p>At this point we have a regular Swift Charts line. Nothing dynamic yet.</p><div><hr></div><h2>Part 2: Add an Area Plot</h2><p>The final effect looks better if the active part of the chart has a little visual weight below the line.</p><p>So let&#8217;s add an <code>AreaPlot</code> using the same data:</p><pre><code><code>AreaPlot(
    dailyActivity,
    x: .value("Date", \.date),
    y: .value("Duration", \.duration)
)
.interpolationMethod(.catmullRom)
.foregroundStyle(lineGradient)
.opacity(0.35)</code></code></pre><p>The important detail is that the line and area use the same X/Y values and interpolation method. That means they sit exactly on top of each other.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pq7m!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab61b389-912f-4352-b3b1-33efde091f83_804x686.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pq7m!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab61b389-912f-4352-b3b1-33efde091f83_804x686.png 424w, https://substackcdn.com/image/fetch/$s_!pq7m!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab61b389-912f-4352-b3b1-33efde091f83_804x686.png 848w, https://substackcdn.com/image/fetch/$s_!pq7m!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab61b389-912f-4352-b3b1-33efde091f83_804x686.png 1272w, https://substackcdn.com/image/fetch/$s_!pq7m!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab61b389-912f-4352-b3b1-33efde091f83_804x686.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!pq7m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab61b389-912f-4352-b3b1-33efde091f83_804x686.png" width="440" height="375.4228855721393" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ab61b389-912f-4352-b3b1-33efde091f83_804x686.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:686,&quot;width&quot;:804,&quot;resizeWidth&quot;:440,&quot;bytes&quot;:141167,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/215470171?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab61b389-912f-4352-b3b1-33efde091f83_804x686.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pq7m!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab61b389-912f-4352-b3b1-33efde091f83_804x686.png 424w, https://substackcdn.com/image/fetch/$s_!pq7m!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab61b389-912f-4352-b3b1-33efde091f83_804x686.png 848w, https://substackcdn.com/image/fetch/$s_!pq7m!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab61b389-912f-4352-b3b1-33efde091f83_804x686.png 1272w, https://substackcdn.com/image/fetch/$s_!pq7m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab61b389-912f-4352-b3b1-33efde091f83_804x686.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Line + Area Chart</figcaption></figure></div><p>For now the area is visible across the whole chart. Later we&#8217;ll mask it together with the selected range.</p><div><hr></div><h2>Part 3: Track the Selection</h2><p>Swift Charts already gives us the interaction we need:</p><pre><code><code>.chartXSelection(value: $selectedX)</code></code></pre><p>with:</p><pre><code><code>@State private var selectedX: Date?</code></code></pre><p>Now dragging across the plot updates <code>selectedX</code>.</p><p>This is much better than building our own gesture and translating screen coordinates into chart values manually.</p><p>The chart already knows its scale. We only need the selected date.</p><div><hr></div><h2>Part 4: Show the Selection</h2><p>A selection without feedback is hard to understand, so let&#8217;s add a <code>RuleMark</code>.</p><pre><code><code>if let selectedX {
    RuleMark(x: .value("Selected Date", selectedX))
        .foregroundStyle(.mint)
        .lineStyle(
            StrokeStyle(
                lineWidth: 1,
                dash: [5, 4]
            )
        )
}</code></code></pre><p>We can also show the closest activity point as an annotation:</p><pre><code><code>.annotation(position: .top, alignment: .leading) {
    if let activity = selectedActivity {
        VStack(alignment: .leading, spacing: 2) {
            Text(
                selectedX,
                format: .dateTime.weekday(.abbreviated)
            )
            .font(.caption.weight(.semibold))

            Text("\(activity.duration) mins")
                .font(.caption2)
        }
        .foregroundStyle(.black)
        .padding(6)
        .background(
            RoundedRectangle(cornerRadius: 16)
                .foregroundStyle(.gray.opacity(0.3))
        )
    }
}</code></code></pre><p>The nearest model is calculated independently from the chart:</p><pre><code><code>private var selectedActivity: DailyActivity? {
    guard let selectedX else {
        return nil
    }

    return dailyActivity.min {
        abs($0.date.timeIntervalSince(selectedX))
            &lt; abs($1.date.timeIntervalSince(selectedX))
    }
}</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!bHeV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e07a4d-9ccc-47b0-8a20-371047f6ef2c_800x686.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bHeV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e07a4d-9ccc-47b0-8a20-371047f6ef2c_800x686.png 424w, https://substackcdn.com/image/fetch/$s_!bHeV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e07a4d-9ccc-47b0-8a20-371047f6ef2c_800x686.png 848w, https://substackcdn.com/image/fetch/$s_!bHeV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e07a4d-9ccc-47b0-8a20-371047f6ef2c_800x686.png 1272w, https://substackcdn.com/image/fetch/$s_!bHeV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e07a4d-9ccc-47b0-8a20-371047f6ef2c_800x686.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!bHeV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e07a4d-9ccc-47b0-8a20-371047f6ef2c_800x686.png" width="440" height="377.3" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a0e07a4d-9ccc-47b0-8a20-371047f6ef2c_800x686.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:686,&quot;width&quot;:800,&quot;resizeWidth&quot;:440,&quot;bytes&quot;:196871,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/215470171?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e07a4d-9ccc-47b0-8a20-371047f6ef2c_800x686.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!bHeV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e07a4d-9ccc-47b0-8a20-371047f6ef2c_800x686.png 424w, https://substackcdn.com/image/fetch/$s_!bHeV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e07a4d-9ccc-47b0-8a20-371047f6ef2c_800x686.png 848w, https://substackcdn.com/image/fetch/$s_!bHeV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e07a4d-9ccc-47b0-8a20-371047f6ef2c_800x686.png 1272w, https://substackcdn.com/image/fetch/$s_!bHeV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e07a4d-9ccc-47b0-8a20-371047f6ef2c_800x686.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Line + Area + Selection</figcaption></figure></div><p>At this stage the interaction works, but there&#8217;s one small problem.</p><div><hr></div><h2>Part 5: Keep the Selection Inside the Data</h2><p><code>chartXSelection</code> can move slightly outside the actual first and last data points, depending on the plot area and its padding.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HWjZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe328c9ad-a203-44bd-a7b5-ad127e46bf78_804x686.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HWjZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe328c9ad-a203-44bd-a7b5-ad127e46bf78_804x686.png 424w, https://substackcdn.com/image/fetch/$s_!HWjZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe328c9ad-a203-44bd-a7b5-ad127e46bf78_804x686.png 848w, https://substackcdn.com/image/fetch/$s_!HWjZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe328c9ad-a203-44bd-a7b5-ad127e46bf78_804x686.png 1272w, https://substackcdn.com/image/fetch/$s_!HWjZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe328c9ad-a203-44bd-a7b5-ad127e46bf78_804x686.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!HWjZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe328c9ad-a203-44bd-a7b5-ad127e46bf78_804x686.png" width="440" height="375.4228855721393" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e328c9ad-a203-44bd-a7b5-ad127e46bf78_804x686.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:686,&quot;width&quot;:804,&quot;resizeWidth&quot;:440,&quot;bytes&quot;:142505,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/215470171?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe328c9ad-a203-44bd-a7b5-ad127e46bf78_804x686.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HWjZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe328c9ad-a203-44bd-a7b5-ad127e46bf78_804x686.png 424w, https://substackcdn.com/image/fetch/$s_!HWjZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe328c9ad-a203-44bd-a7b5-ad127e46bf78_804x686.png 848w, https://substackcdn.com/image/fetch/$s_!HWjZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe328c9ad-a203-44bd-a7b5-ad127e46bf78_804x686.png 1272w, https://substackcdn.com/image/fetch/$s_!HWjZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe328c9ad-a203-44bd-a7b5-ad127e46bf78_804x686.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Out-of-bounds selection</figcaption></figure></div><p>For this UI we don&#8217;t want that.</p><p>First define the real data range:</p><pre><code><code>private var dateDomain: ClosedRange&lt;Date&gt; {
    guard let firstDate = dailyActivity.first?.date,
          let lastDate = dailyActivity.last?.date else {
        return .now ... .now
    }

    return min(firstDate, lastDate) ... max(firstDate, lastDate)
}</code></code></pre><p>Then clamp every new selection:</p><pre><code><code>.onChange(of: selectedX) { _, newValue in
    guard let newValue else {
        return
    }

    let clampedValue = min(
        max(newValue, dateDomain.lowerBound),
        dateDomain.upperBound
    )

    if clampedValue != newValue {
        selectedX = clampedValue
    }
}</code></code></pre><p>And use the same domain for the chart scale:</p><pre><code><code>.chartXScale(
    domain: dateDomain,
    range: .plotDimension(
        startPadding: 16,
        endPadding: 16
    )
)</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lJMw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a04fd0e-e1c8-4093-be45-b7bc2e03d8ec_804x686.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lJMw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a04fd0e-e1c8-4093-be45-b7bc2e03d8ec_804x686.png 424w, https://substackcdn.com/image/fetch/$s_!lJMw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a04fd0e-e1c8-4093-be45-b7bc2e03d8ec_804x686.png 848w, https://substackcdn.com/image/fetch/$s_!lJMw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a04fd0e-e1c8-4093-be45-b7bc2e03d8ec_804x686.png 1272w, https://substackcdn.com/image/fetch/$s_!lJMw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a04fd0e-e1c8-4093-be45-b7bc2e03d8ec_804x686.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!lJMw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a04fd0e-e1c8-4093-be45-b7bc2e03d8ec_804x686.png" width="440" height="375.4228855721393" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9a04fd0e-e1c8-4093-be45-b7bc2e03d8ec_804x686.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:686,&quot;width&quot;:804,&quot;resizeWidth&quot;:440,&quot;bytes&quot;:149957,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/215470171?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a04fd0e-e1c8-4093-be45-b7bc2e03d8ec_804x686.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lJMw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a04fd0e-e1c8-4093-be45-b7bc2e03d8ec_804x686.png 424w, https://substackcdn.com/image/fetch/$s_!lJMw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a04fd0e-e1c8-4093-be45-b7bc2e03d8ec_804x686.png 848w, https://substackcdn.com/image/fetch/$s_!lJMw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a04fd0e-e1c8-4093-be45-b7bc2e03d8ec_804x686.png 1272w, https://substackcdn.com/image/fetch/$s_!lJMw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a04fd0e-e1c8-4093-be45-b7bc2e03d8ec_804x686.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Selection normalized</figcaption></figure></div><p>Now the interaction stays inside the meaningful chart range.</p><div><hr></div><h2>Part 6: Mask the Active Range</h2><p>This is the part that finally unlocked the feature.</p><p>Instead of rebuilding the dataset up to the selected point, we keep the entire plot and mask its rendering.</p><p>The mask is another chart mark:</p><pre><code><code>.mask {
    if let startDate = dailyActivity.first?.date,
       let lastDate = dailyActivity.last?.date {

        RectanglePlot(
            dailyActivity,
            xStart: .value("Start", startDate),
            xEnd: .value(
                "End",
                selectedX ?? lastDate
            )
        )
        .accessibilityHidden(true)
    }
}</code></code></pre><p>The <code>RectanglePlot</code> starts at the first date and ends at either:</p><ul><li><p>the current selection;</p></li><li><p>or the last date when there is no selection.</p></li></ul><p>Apply the same mask to both the active <code>AreaPlot</code> and the main line.</p><p>Now only the left side of the selected point remains visible.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hkUZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b271f3-34d9-4630-995c-8535ffdf62b4_800x686.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hkUZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b271f3-34d9-4630-995c-8535ffdf62b4_800x686.png 424w, https://substackcdn.com/image/fetch/$s_!hkUZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b271f3-34d9-4630-995c-8535ffdf62b4_800x686.png 848w, https://substackcdn.com/image/fetch/$s_!hkUZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b271f3-34d9-4630-995c-8535ffdf62b4_800x686.png 1272w, https://substackcdn.com/image/fetch/$s_!hkUZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b271f3-34d9-4630-995c-8535ffdf62b4_800x686.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!hkUZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b271f3-34d9-4630-995c-8535ffdf62b4_800x686.png" width="440" height="377.3" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/11b271f3-34d9-4630-995c-8535ffdf62b4_800x686.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:686,&quot;width&quot;:800,&quot;resizeWidth&quot;:440,&quot;bytes&quot;:135918,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/215470171?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b271f3-34d9-4630-995c-8535ffdf62b4_800x686.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hkUZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b271f3-34d9-4630-995c-8535ffdf62b4_800x686.png 424w, https://substackcdn.com/image/fetch/$s_!hkUZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b271f3-34d9-4630-995c-8535ffdf62b4_800x686.png 848w, https://substackcdn.com/image/fetch/$s_!hkUZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b271f3-34d9-4630-995c-8535ffdf62b4_800x686.png 1272w, https://substackcdn.com/image/fetch/$s_!hkUZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b271f3-34d9-4630-995c-8535ffdf62b4_800x686.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Line + Area + Selection + Trim</figcaption></figure></div><p>And importantly, the actual chart data never changes.</p><div><hr></div><h2>Part 7: Add the Dimmed Chart Below</h2><p>A mask only hides the rest of the line.</p><p>But the TradingView-style result we want still needs to show the right side (just with lower opacity).</p><p>The easiest way is to render a second copy of the line underneath:</p><pre><code><code>LinePlot(
    dailyActivity,
    x: .value("Date", \.date),
    y: .value("Duration", \.duration)
)
.interpolationMethod(.catmullRom)
.foregroundStyle(lineGradient)
.lineStyle(StrokeStyle(lineWidth: 5))
.symbol(Circle())
.opacity(selectedX == nil ? 0.0 : 0.2)</code></code></pre><p>When there is no selection, the secondary line is hidden.</p><p>As soon as the user selects a point, it appears at low opacity.</p><p>The masked full-opacity line is then rendered on top.</p><p>Visually we get:</p><pre><code><code>Before selection
&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;  opacity 1.0

After selection
&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9474;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;
 opacity 1.0  &#9474; opacity 0.2
              &#9650;
          selectedX</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dKZ2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c77a8d8-034a-40b5-a0cc-9199bf443d41_804x686.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dKZ2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c77a8d8-034a-40b5-a0cc-9199bf443d41_804x686.png 424w, https://substackcdn.com/image/fetch/$s_!dKZ2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c77a8d8-034a-40b5-a0cc-9199bf443d41_804x686.png 848w, https://substackcdn.com/image/fetch/$s_!dKZ2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c77a8d8-034a-40b5-a0cc-9199bf443d41_804x686.png 1272w, https://substackcdn.com/image/fetch/$s_!dKZ2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c77a8d8-034a-40b5-a0cc-9199bf443d41_804x686.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!dKZ2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c77a8d8-034a-40b5-a0cc-9199bf443d41_804x686.png" width="440" height="375.4228855721393" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7c77a8d8-034a-40b5-a0cc-9199bf443d41_804x686.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:686,&quot;width&quot;:804,&quot;resizeWidth&quot;:440,&quot;bytes&quot;:156745,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/215470171?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c77a8d8-034a-40b5-a0cc-9199bf443d41_804x686.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dKZ2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c77a8d8-034a-40b5-a0cc-9199bf443d41_804x686.png 424w, https://substackcdn.com/image/fetch/$s_!dKZ2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c77a8d8-034a-40b5-a0cc-9199bf443d41_804x686.png 848w, https://substackcdn.com/image/fetch/$s_!dKZ2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c77a8d8-034a-40b5-a0cc-9199bf443d41_804x686.png 1272w, https://substackcdn.com/image/fetch/$s_!dKZ2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c77a8d8-034a-40b5-a0cc-9199bf443d41_804x686.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Lines merge state</figcaption></figure></div><p>There is still one subtle issue.</p><div><hr></div><h2>Part 8: Split the Plots into Different Series</h2><p>If two <code>LinePlot</code>s contain the same dataset and use the same X and Y values, Swift Charts can treat them as parts of the same series.</p><p>That can create an unwanted connection between the end of one plot and the beginning of the other.</p><p>The fix is to explicitly separate them:</p><pre><code><code>series: .value("Location", "BelowChart")</code></code></pre><p>for the dimmed chart and:</p><pre><code><code>series: .value("Location", "MainChart")</code></code></pre><p>for the active chart.</p><p>So the two line plots become:</p><pre><code><code>LinePlot(
    dailyActivity,
    x: .value("Date", \.date),
    y: .value("Duration", \.duration),
    series: .value("Location", "BelowChart")
)</code></code></pre><p>and:</p><pre><code><code>LinePlot(
    dailyActivity,
    x: .value("Date", \.date),
    y: .value("Duration", \.duration),
    series: .value("Location", "MainChart")
)</code></code></pre><p>Same data. Same coordinates. Different chart series.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PYyH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60475ba4-9d18-4734-b5e5-5f57f32b7057_800x686.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PYyH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60475ba4-9d18-4734-b5e5-5f57f32b7057_800x686.png 424w, https://substackcdn.com/image/fetch/$s_!PYyH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60475ba4-9d18-4734-b5e5-5f57f32b7057_800x686.png 848w, https://substackcdn.com/image/fetch/$s_!PYyH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60475ba4-9d18-4734-b5e5-5f57f32b7057_800x686.png 1272w, https://substackcdn.com/image/fetch/$s_!PYyH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60475ba4-9d18-4734-b5e5-5f57f32b7057_800x686.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!PYyH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60475ba4-9d18-4734-b5e5-5f57f32b7057_800x686.png" width="440" height="377.3" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/60475ba4-9d18-4734-b5e5-5f57f32b7057_800x686.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:686,&quot;width&quot;:800,&quot;resizeWidth&quot;:440,&quot;bytes&quot;:196871,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/215470171?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60475ba4-9d18-4734-b5e5-5f57f32b7057_800x686.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!PYyH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60475ba4-9d18-4734-b5e5-5f57f32b7057_800x686.png 424w, https://substackcdn.com/image/fetch/$s_!PYyH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60475ba4-9d18-4734-b5e5-5f57f32b7057_800x686.png 848w, https://substackcdn.com/image/fetch/$s_!PYyH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60475ba4-9d18-4734-b5e5-5f57f32b7057_800x686.png 1272w, https://substackcdn.com/image/fetch/$s_!PYyH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F60475ba4-9d18-4734-b5e5-5f57f32b7057_800x686.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Line + Area + Selection + Another Line</figcaption></figure></div><p>That prevents Swift Charts from trying to join them into one continuous path.</p><div><hr></div><h2>The Final Composition</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!eYVn!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8760f7de-06f3-4532-b15f-896c01d13dc6_804x686.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eYVn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8760f7de-06f3-4532-b15f-896c01d13dc6_804x686.png 424w, https://substackcdn.com/image/fetch/$s_!eYVn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8760f7de-06f3-4532-b15f-896c01d13dc6_804x686.png 848w, https://substackcdn.com/image/fetch/$s_!eYVn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8760f7de-06f3-4532-b15f-896c01d13dc6_804x686.png 1272w, https://substackcdn.com/image/fetch/$s_!eYVn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8760f7de-06f3-4532-b15f-896c01d13dc6_804x686.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!eYVn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8760f7de-06f3-4532-b15f-896c01d13dc6_804x686.png" width="440" height="375.4228855721393" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8760f7de-06f3-4532-b15f-896c01d13dc6_804x686.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:686,&quot;width&quot;:804,&quot;resizeWidth&quot;:440,&quot;bytes&quot;:114126,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/215470171?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8760f7de-06f3-4532-b15f-896c01d13dc6_804x686.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!eYVn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8760f7de-06f3-4532-b15f-896c01d13dc6_804x686.png 424w, https://substackcdn.com/image/fetch/$s_!eYVn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8760f7de-06f3-4532-b15f-896c01d13dc6_804x686.png 848w, https://substackcdn.com/image/fetch/$s_!eYVn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8760f7de-06f3-4532-b15f-896c01d13dc6_804x686.png 1272w, https://substackcdn.com/image/fetch/$s_!eYVn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8760f7de-06f3-4532-b15f-896c01d13dc6_804x686.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Line + Area + Selection + Trim + Another Line with opacity</figcaption></figure></div><p>The final chart is built from several layers:</p><pre><code><code>AreaPlot
    &#9492;&#9472;&#9472; masked to selected range

RuleMark
    &#9492;&#9472;&#9472; current selection

LinePlot "BelowChart"
    &#9492;&#9472;&#9472; full range, low opacity

LinePlot "MainChart"
    &#9492;&#9472;&#9472; full range, masked to selected range
</code></code></pre><p>No dataset slicing.</p><p>No repeated recalculation of a partial chart.</p><p>No manual drawing.</p><p>The selection changes only the mask boundary and opacity.</p><p>For me, this was the missing piece. Instead of thinking about the chart as one line that has to be modified, it works much better to think about it as a composition of several complete plots where visibility is controlled independently.</p><div><hr></div><h2>Complete Project</h2><p>The <a href="https://gist.github.com/lanserxt/b8890d6005b80fc6b3b135b75708262c">complete example</a> combines all eight parts in one view. Happy coding!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[iOS 27: CrashReportExtension Framework]]></title><description><![CDATA[Inspect crashed processes to create crash reports]]></description><link>https://antongubarenko.substack.com/p/ios-27-crashreportextension-framework</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/ios-27-crashreportextension-framework</guid><pubDate>Tue, 15 Sep 2026 06:02:04 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/ed915509-1f2d-4398-ac82-d937ad32c241_1254x1254.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Crash reporting on iOS has always had one uncomfortable boundary: by the time the interesting failure happens, the app itself is no longer a trustworthy place to do work.</p><p>That is why putting serious crash-analysis logic into a signal handler has never been a particularly attractive architecture. The process may already be corrupted, locks may be held, memory allocation may be unsafe, and most of the APIs we normally use aren&#8217;t designed to run from that environment. Third-party crash SDKs have spent years working around those constraints, usually with a lot of low-level code that most application teams would rather never own.</p><p>iOS 27 introduces <strong>CrashReportExtension</strong>, and the important part isn&#8217;t simply that Apple added another way to obtain a crash reason. The system now gives our app a dedicated extension that runs <strong>out of process</strong> after the host application crashes. The crashed process stays available through a read-only <code>CrashedProcess</code> client, while the code generating our custom report runs in a separate process managed by the system.</p><p>That changes the architecture completely. Instead of trying to keep the dying app alive long enough to inspect itself, we let the system hand the crash to another process.</p><blockquote><p>&#9888;&#65039;CrashReportExtension is a out of  beta framework and now shipped in iOS 27. It isn&#8217;t available to Catalyst-based macOS apps or iOS apps running on Apple silicon Macs.</p></blockquote><div><hr></div><h2>Why This Is Different from a Signal Handler</h2><p>A traditional in-process crash handler has to be extremely defensive because it runs inside the process that just failed. If the crash happened because memory is corrupted or a lock is stuck, the handler is living inside exactly the environment that caused the problem.</p><p>CrashReportExtension moves the reporting code outside that process:</p><pre><code><code>Main App
   &#9474;
   &#9474; crashes
   &#9660;
System
   &#9474;
   &#9474; launches extension
   &#9660;
Crash Report Extension
   &#9474;
   &#9492;&#9472;&#9472; CrashedProcess &#8594; read-only access to crashed app
</code></code></pre><p>The extension is not a continuation of the app. It is its own app-extension process. Apple calls <code>processCrashReport(process:)</code>and passes a <code>CrashedProcess</code> object that lets us inspect the crashed host.</p><p>That distinction is the reason I find this API interesting. The framework isn&#8217;t replacing Apple&#8217;s <code>.ips</code> crash reports. It gives developers a supported place to perform their <strong>own on-device crash analysis</strong> without installing signal handlers into the application process.</p><div><hr></div><h2>Creating the Extension</h2><p>The easiest way to start is Xcode&#8217;s <strong>Crash Report Extension</strong> template. Xcode creates the extension target, gives it a child bundle identifier, and configures the extension point.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LNkJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a3c71b4-8ed0-40d5-93a3-f0aca272b73b_1420x996.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LNkJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a3c71b4-8ed0-40d5-93a3-f0aca272b73b_1420x996.png 424w, https://substackcdn.com/image/fetch/$s_!LNkJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a3c71b4-8ed0-40d5-93a3-f0aca272b73b_1420x996.png 848w, https://substackcdn.com/image/fetch/$s_!LNkJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a3c71b4-8ed0-40d5-93a3-f0aca272b73b_1420x996.png 1272w, https://substackcdn.com/image/fetch/$s_!LNkJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a3c71b4-8ed0-40d5-93a3-f0aca272b73b_1420x996.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!LNkJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a3c71b4-8ed0-40d5-93a3-f0aca272b73b_1420x996.png" width="1420" height="996" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3a3c71b4-8ed0-40d5-93a3-f0aca272b73b_1420x996.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:996,&quot;width&quot;:1420,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:214686,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/211342551?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a3c71b4-8ed0-40d5-93a3-f0aca272b73b_1420x996.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LNkJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a3c71b4-8ed0-40d5-93a3-f0aca272b73b_1420x996.png 424w, https://substackcdn.com/image/fetch/$s_!LNkJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a3c71b4-8ed0-40d5-93a3-f0aca272b73b_1420x996.png 848w, https://substackcdn.com/image/fetch/$s_!LNkJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a3c71b4-8ed0-40d5-93a3-f0aca272b73b_1420x996.png 1272w, https://substackcdn.com/image/fetch/$s_!LNkJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a3c71b4-8ed0-40d5-93a3-f0aca272b73b_1420x996.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Crash Reporter Extension creation</figcaption></figure></div><p>The bundle identifier must remain below the containing application&#8217;s identifier. For example:</p><pre><code><code>App:
com.example.UtilityApp

Crash extension:
com.example.UtilityApp.crash-reporter</code></code></pre><p>The extension&#8217;s property list declares:</p><pre><code><code>&lt;dict&gt;
    &lt;key&gt;EXAppExtensionAttributes&lt;/key&gt;
    &lt;dict&gt;
        &lt;key&gt;EXExtensionPointIdentifier&lt;/key&gt;
        &lt;string&gt;com.apple.crash-reporter.extension&lt;/string&gt;
    &lt;/dict&gt;
&lt;/dict&gt;</code></code></pre><p>If you use the Xcode template, this setup is generated for you. I would use the template rather than creating the target manually unless you have a very specific build-system reason not to.</p><div><hr></div><h2>The Entire Entry Point Is One Method</h2><p>A crash reporter conforms to <code>CrashReporterExtension</code>:</p><pre><code><code>import CrashReportExtension

@main
struct UtilityCrashReporterExtension: CrashReporterExtension {
    func processCrashReport(process: CrashedProcess) {
        // Inspect the crashed application here.
    }
}</code></code></pre><p><code>processCrashReport(process:)</code> is synchronous. The system invokes it when the crash is ready to be processed, and <code>process</code> is our client for inspecting the crashed host.</p><p>Apple&#8217;s API surface is intentionally small. <code>CrashedProcess</code> currently gives us the crash reason, loaded binary images, a read-only Mach corpse port, address symbolication, and symbol lookup. There is no giant <code>CrashReport</code> object that mirrors an <code>.ips</code>file, and I think that is an important expectation to set before building on the framework.</p><blockquote><p><strong>Warning!</strong> This framework is for on-device run only. It will not run on simulator currently. To make it compilable one of the options to:<br><span>UtilityCrashReporterExtension</span> &#8594; <strong>Build Phases</strong> &#8594; <strong>Link Binary With Libraries</strong></p></blockquote><div><hr></div><h2>Start with the Crash Reason</h2><p>The most obvious information is <code>reason</code>:</p><pre><code><code>let reason = process.reason

print(reason.exception)
print(reason.codes)</code></code></pre><p><code>CrashReason</code> contains the Mach exception type and exception-specific codes:</p><pre><code><code>struct CrashReason {
    let exception: Int32
    let codes: [UInt64]
}</code></code></pre><p>These aren&#8217;t Swift <code>Error</code> values and they aren&#8217;t Objective-C exceptions. They describe the low-level reason the process terminated.</p><p>For example, a memory-access failure and a breakpoint trap produce different Mach exception values and codes. I would keep these raw values in a custom crash envelope even if the backend later translates them into friendlier names. Throwing away the original reason early makes later analysis harder.</p><p>In the complete example I store exactly that:</p><pre><code><code>reason = Reason(
    exception: crashReason.exception,
    codes: crashReason.codes
)</code></code></pre><div><hr></div><h2>Binary Images</h2><p><code>CrashedProcess.binaryImages</code> returns the images loaded into the process at the moment of failure:</p><pre><code><code>let images = process.binaryImages</code></code></pre><p>That includes the application executable, frameworks, and other loaded code. Anyone who has manually symbolicated a crash already knows why this list matters. An address by itself isn&#8217;t enough. We normally need to know which image owned the address, where that image was loaded, and which build it came from before the address becomes a useful symbol.</p><blockquote><p>It&#8217;s not an UIImage or something&#8230;</p></blockquote><p>The new framework exposes these images directly through <code>BinaryImageInfo</code>.</p><p>For the sample project I deliberately <strong>don&#8217;t create my own fake mirror of </strong><code>BinaryImageInfo</code>. It is a beta structure and the article doesn&#8217;t need to invent a second crash-file schema just to demonstrate the framework. The minimal report stores the image count and leaves richer image serialization as a product-specific decision:</p><pre><code><code>binaryImageCount = process.binaryImages.count</code></code></pre><p>In a production crash SDK, this is exactly where I would decide which image information my backend genuinely needs and preserve it in a stable server contract.</p><div><hr></div><h2>Symbol Lookup and Symbolication</h2><p><code>CrashedProcess</code> has two complementary APIs. If you already have an address, you can symbolicate one or many of them:</p><pre><code><code>let frames = process.symbolicateAddress(address)

let allFrames = process.symbolicateAddresses(addresses)</code></code></pre><p>The framework returns <code>SymbolicatedFrame</code> values, including inline-frame expansion. A frame currently exposes <code>symbol</code>, <code>symbolOffset</code>, <code>sourceFile</code>, <code>sourceLine</code>, and <code>isInline</code>.</p><p>That is a much nicer boundary than shipping a pile of hexadecimal addresses to some random utility code and rebuilding symbolication yourself.</p><p>There is also lookup in the opposite direction:</p><pre><code><code>let address = process.symbolAddress(
    imageName: nil,
    symbolName: "malloc_error_break"
)</code></code></pre><p>Given a symbol name, we can obtain its runtime address in the crashed process and then symbolicate that address.</p><p>The sample uses this only as a small demonstration of the lookup APIs. It checks a couple of well-known diagnostic symbols and persists their symbolicated frames when they are available:</p><pre><code><code>let address = process.symbolAddress(
    imageName: nil,
    symbolName: symbolName
)

guard address != 0 else {
    return nil
}

let frames = process.symbolicateAddress(address)</code></code></pre><p>One thing I <strong>wouldn&#8217;t</strong> do is pretend that these APIs automatically give us the crashed thread&#8217;s full backtrace. Apple&#8217;s current <code>CrashedProcess</code> documentation exposes symbolication and a read-only corpse port, but it does not expose a convenient <code>crashedThread.frames</code> property. If you want deeper process inspection, that moves into Mach-level work through <code>corpsePort</code>.</p><p>That is a very different article.</p><div><hr></div><h2>The Corpse Port</h2><p>This is the low-level door:</p><pre><code><code>let corpsePort = process.corpsePort</code></code></pre><p><code>corpsePort</code> is a Mach port providing read-only access to the crashed process. It exists for developers who need deeper inspection than the high-level properties and symbolication helpers provide.</p><p>The word <em>corpse</em> sounds scary tbh, but it is established Mach terminology: the process is no longer executing, while the system preserves enough state for inspection.</p><p>For most application teams, I would start with <code>reason</code>, <code>binaryImages</code>, and the symbolication APIs before going anywhere near custom Mach IPC. Once you start reading task state, thread state, or memory through Mach interfaces, you&#8217;re building a real crash-analysis engine rather than a small reporting extension.</p><p>The complete sample records the port value for diagnostics but doesn&#8217;t issue Mach commands:</p><pre><code><code>corpsePort = UInt32(process.corpsePort)</code></code></pre><p>That keeps the example focused on CrashReportExtension itself.</p><div><hr></div><h2>Build a Small Crash Envelope</h2><p>I don&#8217;t think a custom crash reporter needs to reproduce Apple&#8217;s entire <code>.ips</code> format.</p><p>Apple already generates excellent system crash reports. If we build a custom format, it should contain the information our product actually needs.</p><p>For the utility demo I use:</p><pre><code><code>struct CrashEnvelope: Codable {
    let createdAt: Date
    let reason: Reason
    let binaryImageCount: Int
    let corpsePort: UInt32
    let diagnosticSymbols: [Symbol]
}</code></code></pre><p>This is intentionally boring. It gives us a timestamp, raw Mach reason, a little process context, and a place for symbolication data. A real application could add its own persisted breadcrumbs, current feature state, release channel, or other information that existed <strong>before</strong> the crash.</p><p>And that last part is important.</p><p>The extension can&#8217;t magically reconstruct arbitrary Swift application state that was never persisted anywhere. If you want to know that the user was exporting a PDF, syncing a library, or connecting a VPN when the crash happened, record that state safely during normal execution and combine it with the crash report later.</p><p>CrashReportExtension gives us the crashed process. It doesn&#8217;t turn every object graph into Codable.</p><div><hr></div><h2>Persist First, Upload Later</h2><p>Apple says the extension can persist a report or send it to a server you control.</p><p>For a sample, I prefer the boring option: write JSON locally.</p><pre><code><code>let encoder = JSONEncoder()
encoder.outputFormatting = [
    .prettyPrinted,
    .sortedKeys
]
encoder.dateEncodingStrategy = .iso8601

let data = try encoder.encode(report)

try data.write(
    to: fileURL,
    options: [.atomic]
)</code></code></pre><p>Why not put a big networking client into <code>processCrashReport(process:)</code>? Because this is crash handling. I want the extension path to stay small, predictable, and defensive. Networking introduces reachability, authentication, retries, timeouts, and lifecycle questions that have nothing to do with inspecting the crashed process.</p><p>In a production architecture, I would generally prefer:</p><pre><code><code>Crash
  &#8595;
Extension creates compact report
  &#8595;
Persist
  &#8595;
Normal app / dedicated upload path sends later</code></code></pre><p>The exact handoff mechanism depends on your app architecture and container setup. I wouldn&#8217;t casually claim that every extension can share arbitrary files with its host without designing the appropriate shared-container configuration.</p><p>The sample therefore persists inside the extension&#8217;s Application Support directory and stops there.</p><div><hr></div><h2>Making Reports Accessible from the Main App</h2><p>A Crash Report Extension has its own sandbox, so writing into the extension&#8217;s normal Application Support directory does not make that file automatically visible to the containing app.</p><p>If the main application needs to upload, display, or otherwise process the generated reports later, both targets can use the same <strong>App Group</strong>. Enable the App Groups capability for the application target and the Crash Report Extension target, then add the same identifier to both. For example:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;plaintext&quot;,&quot;nodeId&quot;:&quot;cbe1269c-5d08-40fa-82e0-7d8f7876c575&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-plaintext">group.com.example.UtilityApp</code></pre></div><p>The extension resolves the shared container instead of its private Application Support directory:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;plaintext&quot;,&quot;nodeId&quot;:&quot;c447ce37-d472-494e-85c7-b99d6eb145ca&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-plaintext">private func reportsDirectory() throws -&gt; URL {
    guard let containerURL = FileManager.default.containerURL(
        forSecurityApplicationGroupIdentifier: "group.com.example.UtilityApp"
    ) else {
        throw CocoaError(.fileNoSuchFile)
    }

    let directory = containerURL.appendingPathComponent(
        "CrashReports",
        isDirectory: true
    )

    try FileManager.default.createDirectory(
        at: directory,
        withIntermediateDirectories: true
    )

    return directory
}</code></pre></div><p>This is already the storage location used by the complete extension sample below. Once the host app launches again, it can resolve the same App Group container and enumerate the saved reports:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;swift&quot;,&quot;nodeId&quot;:&quot;aa43d915-aa71-4467-99f6-9cbd1fc3cc7a&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-swift">struct StoredCrashReport {
    let url: URL
}

struct CrashReportReader {
    private let fileManager = FileManager.default

    func reports() throws -&gt; [StoredCrashReport] {
        guard let containerURL = fileManager.containerURL(
            forSecurityApplicationGroupIdentifier: "group.com.example.UtilityApp"
        ) else {
            throw CocoaError(.fileNoSuchFile)
        }

        let reportsURL = containerURL.appendingPathComponent(
            "CrashReports",
            isDirectory: true
        )

        let urls = try fileManager.contentsOfDirectory(
            at: reportsURL,
            includingPropertiesForKeys: nil
        )

        return urls
            .filter { $0.pathExtension == "json" }
            .map(StoredCrashReport.init)
    }
}</code></pre></div><p>From there, the main app can decode the JSON, attach additional application metadata, upload it through the normal networking stack, and delete the file after a successful upload.</p><p>I&#8217;ve added a small View with files loaded from app sandbox:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Dmq5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf8370ef-b96f-42dc-86b8-942adb20e167_1668x2388.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Dmq5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf8370ef-b96f-42dc-86b8-942adb20e167_1668x2388.png 424w, https://substackcdn.com/image/fetch/$s_!Dmq5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf8370ef-b96f-42dc-86b8-942adb20e167_1668x2388.png 848w, https://substackcdn.com/image/fetch/$s_!Dmq5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf8370ef-b96f-42dc-86b8-942adb20e167_1668x2388.png 1272w, https://substackcdn.com/image/fetch/$s_!Dmq5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf8370ef-b96f-42dc-86b8-942adb20e167_1668x2388.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!Dmq5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf8370ef-b96f-42dc-86b8-942adb20e167_1668x2388.png" width="1456" height="2084" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bf8370ef-b96f-42dc-86b8-942adb20e167_1668x2388.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2084,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:170426,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/211342551?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf8370ef-b96f-42dc-86b8-942adb20e167_1668x2388.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Dmq5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf8370ef-b96f-42dc-86b8-942adb20e167_1668x2388.png 424w, https://substackcdn.com/image/fetch/$s_!Dmq5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf8370ef-b96f-42dc-86b8-942adb20e167_1668x2388.png 848w, https://substackcdn.com/image/fetch/$s_!Dmq5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf8370ef-b96f-42dc-86b8-942adb20e167_1668x2388.png 1272w, https://substackcdn.com/image/fetch/$s_!Dmq5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf8370ef-b96f-42dc-86b8-942adb20e167_1668x2388.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">List of crashes</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HIC-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2cff84a-11f9-4f9b-a89d-60ce17afac32_1668x2388.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HIC-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2cff84a-11f9-4f9b-a89d-60ce17afac32_1668x2388.png 424w, https://substackcdn.com/image/fetch/$s_!HIC-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2cff84a-11f9-4f9b-a89d-60ce17afac32_1668x2388.png 848w, https://substackcdn.com/image/fetch/$s_!HIC-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2cff84a-11f9-4f9b-a89d-60ce17afac32_1668x2388.png 1272w, https://substackcdn.com/image/fetch/$s_!HIC-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2cff84a-11f9-4f9b-a89d-60ce17afac32_1668x2388.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!HIC-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2cff84a-11f9-4f9b-a89d-60ce17afac32_1668x2388.png" width="1456" height="2084" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a2cff84a-11f9-4f9b-a89d-60ce17afac32_1668x2388.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2084,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:418374,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/211342551?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2cff84a-11f9-4f9b-a89d-60ce17afac32_1668x2388.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HIC-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2cff84a-11f9-4f9b-a89d-60ce17afac32_1668x2388.png 424w, https://substackcdn.com/image/fetch/$s_!HIC-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2cff84a-11f9-4f9b-a89d-60ce17afac32_1668x2388.png 848w, https://substackcdn.com/image/fetch/$s_!HIC-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2cff84a-11f9-4f9b-a89d-60ce17afac32_1668x2388.png 1272w, https://substackcdn.com/image/fetch/$s_!HIC-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2cff84a-11f9-4f9b-a89d-60ce17afac32_1668x2388.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Crashes details modal</figcaption></figure></div><p>The important point is ownership. The crash extension should do the smallest reliable amount of work needed to capture the crash. The containing application is a much better place for retries, authentication, batching, and cleanup.</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;plaintext&quot;,&quot;nodeId&quot;:&quot;3587e1b7-3fad-49e5-8e9d-d99f0ae77b7b&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-plaintext">Host App crashes
      &#8595;
Crash Report Extension
      &#8595;
Shared App Group / CrashReports
      &#8595;
Host App launches again
      &#8595;
Read &#8594; Upload &#8594; Delete</code></pre></div><p><span>App Groups also make the storage contract explicit. If only the extension has the capability, or the identifiers differ between the two targets, </span><code>containerURL(forSecurityApplicationGroupIdentifier:)</code><span> won&#8217;t give both processes access to the same directory.</span></p><div><hr></div><h2>&#9888;&#65039;Don&#8217;t Replace Apple&#8217;s Crash Reports</h2><p>A custom crash report is not automatically better than the system report. Or 3rd party services would not exist.</p><p>Apple&#8217;s <code>.ips</code> reports contain thread backtraces, registers, binary images, termination information, VM information, OS metadata, and a lot of context that would be expensive to recreate badly. Apple&#8217;s own debugging documentation still recommends using the system crash report whenever possible.</p><p>So I see CrashReportExtension as complementary.</p><p>Use the system report for deep postmortem analysis. Use your extension when you need something product-specific: immediate on-device classification, a compact envelope for your backend, correlation with your own persisted breadcrumbs, special symbol lookup, domain-specific crash diagnostics, or controlled on-device processing before upload.</p><p>If your goal is simply &#8220;I want crash reports in Xcode Organizer,&#8221; you already have that.</p><div><hr></div><h2>Why Out-of-Process Is the Real Feature</h2><p>It is easy to focus on <code>symbolicateAddress</code> because it is the most visible API. For me, the bigger change is the execution model.</p><p>The reporting code isn&#8217;t running from the crashed app&#8217;s signal handler. That means our extension can use normal Swift structure and Foundation APIs without pretending that the failed process is healthy enough to run arbitrary application code. The crash target becomes data to inspect rather than the environment doing the inspection.</p><p>This doesn&#8217;t mean the extension should become huge. It is still system-managed crash handling, and I would keep its dependencies aggressively small. But the boundary is dramatically cleaner than installing a complex reporter inside the host process.</p><div><hr></div><h2>Testing the Extension</h2><p>Crash extensions are different from normal feature extensions because the trigger is intentionally destructive: the host app has to crash.</p><p>That makes debugging a little awkward. Once the app dies, the original LLDB session is naturally affected, while the system launches the crash reporter as a separate process.</p><p>First, I&#8217;ve tried Logger</p><p>Test in layers. Keep report encoding and storage as normal Swift types that can be unit tested independently. Make the <code>CrashReporterExtension</code> entry point very small. Trigger known development crashes from a dedicated debug-only screen. Verify that the expected report appears after relaunch or through whatever collection path your app uses. Finally, compare your custom data with the system <code>.ips</code> report rather than assuming your interpretation of the Mach reason is correct.</p><blockquote><p>And please don&#8217;t ship a crash code accidentally! That would be a particularly honest QA feature. We don&#8217;t want that )</p></blockquote><h3>Debugging with Console.app</h3><p>There is one more practical issue: the crash-report extension can live for only a very short time. In my testing, relying on regular <code>print</code> output (and even higher-level logging that you expect to see immediately in Xcode) is not a great debugging strategy because the extension may finish before that output becomes useful. That keep me away actually fro this article creation. First, I had an idea that this extension is not working in Beta, then not working with Beta on my testing device, but I was fully sure that in RC it should work. With a pretty good experience with <strong>Console.app</strong>, finding the actual problem started with switching to <code>os_log</code>, since it&#8217;s one of the low-level functions.</p><p>One of the few reliable options left is the unified logging system and <strong>Console.app</strong>. Add a small <code>os_log</code> call inside the extension and then watch the device log from Console on your Mac:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;plaintext&quot;,&quot;nodeId&quot;:&quot;b30c4e74-32cc-4543-a9d2-03440d7a4b4f&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-plaintext">import os.log

private let crashLog = OSLog(
    subsystem: "com.example.UtilityApp.crash-reporter",
    category: "CrashReportExtension"
)

func processCrashReport(process: CrashedProcess) {
    os_log(
        "Crash report extension started. Exception: %{public}d",
        log: crashLog,
        type: .debug,
        process.reason.exception
    )

    // Build and persist the report...
}</code></pre></div><p><a href="https://gist.github.com/lanserxt/7ab34c77c823727b34b67c5d6d0ba521">Full source code available of course</a></p><div><hr></div><h2>Where It Fits</h2><p>I think CrashReportExtension will be most interesting to teams that already have mature diagnostics rather than apps that just want basic crash collection.</p><p>If you operate your own crash backend, maintain an anti-fraud or integrity SDK, need application-specific breadcrumbs, or want to do a small amount of on-device analysis before storing a report, the out-of-process hook is powerful. It gives you a supported lifecycle point and a typed view into the crashed process instead of forcing everything through an in-process crash handler.</p><p>For many indie apps, Apple&#8217;s normal crash reports plus MetricKit will still be enough. A new framework doesn&#8217;t mean every app needs to build its own Crashlytics.</p><div><hr></div><h2>Limitations</h2><p>A few things I would keep in mind:</p><ul><li><p>CrashReportExtension requires iOS 27 (as I said before)</p></li><li><p>The crash reporter runs in a separate extension process</p></li><li><p><code>processCrashReport(process:)</code> is synchronous</p></li><li><p><code>CrashReason</code> exposes Mach exception data, not a high-level Swift error</p></li><li><p><code>CrashedProcess</code> provides binary images, symbolication, symbol lookup, and a read-only corpse port</p></li><li><p>The high-level API doesn&#8217;t expose a ready-made full crashed-thread backtrace</p></li><li><p>Deeper inspection through <code>corpsePort</code> is Mach-level work</p></li><li><p>The extension&#8217;s bundle identifier must be a child of the containing app&#8217;s identifier</p></li><li><p>The framework isn&#8217;t available to Catalyst-based macOS apps or iOS apps running on Apple silicon Macs</p></li><li><p>A custom report should complement rather than blindly duplicate Apple&#8217;s <code>.ips</code> report</p></li><li><p>Keep the extension small; crash handling isn&#8217;t a great place to bring your entire application dependency graph</p></li></ul><p>The API is tiny, but the design space behind it is not. That&#8217;s probably a good thing. Apple provides the safe process boundary and the crash-inspection primitives, while the app decides how much crash infrastructure it actually wants to own.</p><div><hr></div><h2>References</h2><ul><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/crashreportextension">CrashReportExtension</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/crashreportextension/crashreporterextension">CrashReporterExtension</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/crashreportextension/crashedprocess">CrashedProcess</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/crashreportextension/crashreporterextension/processcrashreport(process:)">processCrashReport(process:)</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/crashreportextension/crashreason">CrashReason</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/crashreportextension/symbolicatedframe">SymbolicatedFrame</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/xcode/examining-the-fields-in-a-crash-report">Examining the fields in a crash report</a></p></li><li><p>Apple Documentation: <a href="https://developer.apple.com/documentation/xcode/acquiring-crash-reports-and-diagnostic-logs">Acquiring crash reports and diagnostic logs</a></p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[Swift Bits: Claude.md Location]]></title><description><![CDATA[Where to place the critical file?]]></description><link>https://antongubarenko.substack.com/p/swift-bits-claudemd-location</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/swift-bits-claudemd-location</guid><pubDate>Fri, 11 Sep 2026 10:56:14 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!hSXf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18197321-e357-4506-b948-740de1fe19f4_1800x2638.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Where should your <code>CLAUDE.md</code> actually live?</p><p>It depends on <strong>who the instructions are for and how much of the codebase they should affect</strong>.</p><p>Some rules are personal and should follow you across every project. Others describe the architecture, commands, and conventions of a specific repository. Large projects can go even further and provide additional context only when Claude works inside a particular feature or module.</p><p>There&#8217;s also <code>CLAUDE.local.md</code> for project-specific instructions you don&#8217;t want to share with the team.</p><p>The important part is not to turn one <code>CLAUDE.md</code> into a huge instruction dump. Put context as close as possible to where it matters and use the appropriate scope.</p><p>I&#8217;ve put the main locations: <strong>Global, Project, Local, Nested, and Managed</strong> - into this quick infographic, along with when to use each one.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hSXf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18197321-e357-4506-b948-740de1fe19f4_1800x2638.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hSXf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18197321-e357-4506-b948-740de1fe19f4_1800x2638.png 424w, https://substackcdn.com/image/fetch/$s_!hSXf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18197321-e357-4506-b948-740de1fe19f4_1800x2638.png 848w, https://substackcdn.com/image/fetch/$s_!hSXf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18197321-e357-4506-b948-740de1fe19f4_1800x2638.png 1272w, https://substackcdn.com/image/fetch/$s_!hSXf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18197321-e357-4506-b948-740de1fe19f4_1800x2638.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hSXf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18197321-e357-4506-b948-740de1fe19f4_1800x2638.png" width="1456" height="2134" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/18197321-e357-4506-b948-740de1fe19f4_1800x2638.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:2134,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:329549,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://antongubarenko.substack.com/i/215196949?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18197321-e357-4506-b948-740de1fe19f4_1800x2638.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hSXf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18197321-e357-4506-b948-740de1fe19f4_1800x2638.png 424w, https://substackcdn.com/image/fetch/$s_!hSXf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18197321-e357-4506-b948-740de1fe19f4_1800x2638.png 848w, https://substackcdn.com/image/fetch/$s_!hSXf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18197321-e357-4506-b948-740de1fe19f4_1800x2638.png 1272w, https://substackcdn.com/image/fetch/$s_!hSXf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F18197321-e357-4506-b948-740de1fe19f4_1800x2638.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>References</h3><ul><li><p><a href="https://code.claude.com/docs/en/memory?utm_source=chatgpt.com">Claude Code &#8212; Memory / CLAUDE.md documentation</a></p></li><li><p><a href="https://code.claude.com/docs?utm_source=chatgpt.com">Claude Code documentation</a></p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[visionOS 27: UILookToScrollInteraction]]></title><description><![CDATA[Excluding UI from Look to Scroll]]></description><link>https://antongubarenko.substack.com/p/visionos-27-uilooktoscrollinteraction</link><guid isPermaLink="false">https://antongubarenko.substack.com/p/visionos-27-uilooktoscrollinteraction</guid><dc:creator><![CDATA[Anton Gubarenko]]></dc:creator><pubDate>Tue, 08 Sep 2026 05:32:57 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/cb7a7967-38fd-4478-b98d-ed61b45e3f0f_1254x1254.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Last time we were working with USDKit and I was already wondering how far from still waters of regular iOS app will I go. Well&#8230; What can be more distant than visionOS update for UIKit controls! Whole Vision Pro is seems not in highlight of development team at Apple. That&#8217;s why updates are so small and controversial. Straight to the topic.</p><blockquote><p>As usual, it&#8217;s still Beta for a couple of days.</p></blockquote><div><hr></div><p>Look to Scroll is a visionOS feature exposed through UIKit, and the name of <code>UILookToScrollInteraction</code> can be slightly misleading at first.</p><p>This is not an iPhone or iPad scrolling API. It applies to UIKit interfaces running on visionOS, where the user can scroll content with their gaze.</p><p>If you want a <code>UIScrollView</code> to support Look to Scroll, you don&#8217;t add <code>UILookToScrollInteraction</code> to it. The actual opt-in lives on <code>UIScrollView</code>:</p><pre><code><code>scrollView.lookToScrollAxes = .vertical</code></code></pre><p>That enables Look to Scroll for the selected axes. <code>UILookToScrollInteraction</code> solves the opposite problem: it lets us mark a region that <strong>shouldn&#8217;t trigger</strong> Look to Scroll.</p><p>This becomes useful when scrollable content has controls close to its edges.</p><blockquote><p>The API is currently beta in visionOS 27 and may still change before the final release. And visionOS is probably will not get many updates upcoming year.</p></blockquote><div><hr></div><h2>A Reader with Floating Controls</h2><p>Imagine a UIKit reading screen running on visionOS. The article fills the whole window and supports vertical Look to Scroll:</p><pre><code><code>scrollView.lookToScrollAxes = .vertical</code></code></pre><p>But we also have a floating Bookmark control near the bottom-right corner. Looking at that button should mean that the user wants to interact with the control, not start scrolling the article.</p><p>That is where the new interaction fits:</p><pre><code><code>controlsView.addInteraction(
    UILookToScrollInteraction.exclusionRegion()
)</code></code></pre><p>Now the bounds of <code>controlsView</code> become an exclusion region for Look to Scroll.</p><p>The important distinction is:</p><pre><code><code>UIScrollView.lookToScrollAxes
        &#8595;
enables Look to Scroll

UILookToScrollInteraction.exclusionRegion()
        &#8595;
prevents a region from triggering Look to Scroll</code></code></pre><div><hr></div><h2>Why Not Disable Look to Scroll?</h2><p>We could always do this:</p><pre><code><code>scrollView.lookToScrollAxes = []</code></code></pre><p>but that disables the feature for the whole scroll view.</p><p>The article body is exactly the kind of large, meaningful content Apple recommends for Look to Scroll on visionOS. We only need to protect a small region containing controls, so an exclusion interaction is a much better fit.</p><p>Apple also documents a few constraints for <code>lookToScrollAxes</code>: use it for meaningful content, don&#8217;t combine it with paging, and keep the number of gaze-scroll-enabled scroll views per scene limited.</p><div><hr></div><h2>Complete Example</h2><p>The complete sample creates a long reader view, enables vertical Look to Scroll, and places a floating Bookmark control over the content. The whole control container is excluded rather than only the button, which gives the interactive region a little breathing room.</p><blockquote><p><code>UILookToScrollInteraction</code> and <code>UIScrollView.lookToScrollAxes</code> are relevant when UIKit is running on <strong>visionOS</strong>. The API lives in UIKit because UIKit apps and UIKit-based interfaces can run on visionOS, but Look to Scroll itself is gaze-driven visionOS interaction rather than a feature for iPhone or iPad.</p></blockquote><p><a href="https://gist.github.com/lanserxt/6232047ea070ce68edd03075a374a546">Complete project on GitHub Gist</a></p><div><hr></div><h2>What about SwiftUI?</h2><p>Who is starting a new project with UIKit on visionOS in 2026? Can we go with SwiftUI instead? Yes, but <strong>not with a native SwiftUI modifier</strong> for this API.</p><p><code>UILookToScrollInteraction</code> and <code>UIScrollView.lookToScrollAxes</code> are UIKit APIs. For a SwiftUI visionOS app, we can bridge the behavior with <code>UIViewRepresentable</code> / <code>UIViewControllerRepresentable</code>.</p><p>For example, the exclusion region can be wrapped:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;rust&quot;,&quot;nodeId&quot;:&quot;d8b5c32e-fa83-49f1-9d08-eebf27c257f6&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-rust">struct LookToScrollExclusionRegion: UIViewRepresentable {

    func makeUIView(context: Context) -&gt; UIView {

        let view = UIView()

        view.addInteraction(

            UILookToScrollInteraction.exclusionRegion()

        )

        return view

    }

    func updateUIView(_ uiView: UIView, context: Context) {}

}</code></pre></div><p>Then use it behind a SwiftUI control:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;plaintext&quot;,&quot;nodeId&quot;:&quot;865d4b8b-4c8e-4dba-a6b2-27347f083545&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-plaintext">Button("Bookmark") {
    bookmark()
}
.background {
    LookToScrollExclusionRegion()
}</code></pre></div><p>This is all because of UILookToScrollInteraction declaration:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;typescript&quot;,&quot;nodeId&quot;:&quot;9815226d-658a-4259-989e-317b624c2619&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-typescript">#import &lt;Foundation/Foundation.h&gt;
#import &lt;UIKit/UIKitDefines.h&gt;
#import &lt;UIKit/UIInteraction.h&gt;

NS_HEADER_AUDIT_BEGIN(nullability, sendability)

UIKIT_EXTERN API_AVAILABLE(visionos(27.0)) API_UNAVAILABLE(ios, watchos, tvos)
@interface UILookToScrollInteraction : NSObject &lt;UIInteraction&gt;

/// An interaction which specifies that the receiver should not trigger Look to Scroll.
+ (instancetype)exclusionRegionInteraction;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

@end

NS_HEADER_AUDIT_END(nullability, sendability)

#else
#import &lt;UIKitCore/UILookToScrollInteraction.h&gt;
#endif</code></pre></div><p>It&#8217;s a nice NSObject which means it&#8217;s purely target&#8217;s old system. Because of performance? Probably.</p><div><hr></div><h2>References</h2><ul><li><p>Apple Developer Documentation: <a href="https://developer.apple.com/documentation/uikit/uilooktoscrollinteraction">UILookToScrollInteraction</a></p></li><li><p>Apple Developer Documentation: <a href="https://developer.apple.com/documentation/uikit/uiscrollview/looktoscrollaxes">UIScrollView.lookToScrollAxes</a></p></li><li><p>Apple Human Interface Guidelines: <a href="https://developer.apple.com/design/human-interface-guidelines/scroll-views">Scroll views</a></p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://antongubarenko.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Anton&#8217;s Substack! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item></channel></rss>