{"id":48780,"date":"2025-08-05T14:29:30","date_gmt":"2025-08-05T18:29:30","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=48780"},"modified":"2025-12-11T13:36:00","modified_gmt":"2025-12-11T18:36:00","slug":"swiftui-documentgroups-are-terribly-limited","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2025\/08\/05\/swiftui-documentgroups-are-terribly-limited\/","title":{"rendered":"SwiftUI DocumentGroups Are Terribly Limited"},"content":{"rendered":"<p><a href=\"https:\/\/christiantietze.de\/posts\/2025\/07\/swiftui-documentgroups-limited\/\">Christian Tietze<\/a>:<\/p>\n<blockquote cite=\"https:\/\/christiantietze.de\/posts\/2025\/07\/swiftui-documentgroups-limited\/\"><p>This is how little you need to get started[&#8230;]<\/p><p>[&#8230;]<\/p><p>What the system does is provide a launch scene for you when you only declare a <code>DocumentGroup<\/code> in your <code>SwiftUI.App.body<\/code>. You can customize this by making the launch scene yourself. <a href=\"https:\/\/wwdcnotes.com\/documentation\/wwdcnotes\/wwdc24-10132-evolve-your-document-launch-experience\/\">WWDC24 &ldquo;Evolve Your Document Launch Experience&rdquo;<\/a> contains examples that at least offer to style what&rsquo;s above the document picker.<\/p><p>[&#8230;]<\/p><p>So I believe they settled for: throw, and we ignore it; but throw immediately on button press, which means throw twice real quick, then you get an alert, because something&rsquo;s broken.<\/p><p>[&#8230;]<\/p><p><code>Scene<\/code>s cannot contain conditionals, the <a href=\"https:\/\/developer.apple.com\/documentation\/swiftui\/scenebuilder\">SceneBuilder<\/a> does not support this. That means there&rsquo;s no way to have an app offer different scenes depending on whether or not in-app purchases have been made.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@timac\/114953551228488193\">Alexandre Colucci<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@timac\/114953551228488193\">\n<p>It baffles my mind that SwiftUI DocumentGroup still lacks the ability to programmatically create or open documents in response to external triggers like Quick Actions, Quick Look, Widgets, or the Files app.<\/p>\n<\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2025\/06\/18\/swiftui-at-wwdc-2025\/\">SwiftUI at WWDC 2025<\/a><\/li>\n<\/ul>\n\n<p id=\"swiftui-documentgroups-are-terribly-limited-update-2025-08-06\">Update (<a href=\"#swiftui-documentgroups-are-terribly-limited-update-2025-08-06\">2025-08-06<\/a>): <a href=\"https:\/\/x.com\/gingerbeardman\/status\/1952849116444410138\">Matt Sephton<\/a>:<\/p>\n<blockquote cite=\"https:\/\/x.com\/gingerbeardman\/status\/1952849116444410138\"><p>I&rsquo;m currently banging my head against this in my forthcoming pixel art app. Horrible.<\/p><\/blockquote>\n\n<p id=\"swiftui-documentgroups-are-terribly-limited-update-2025-12-11\">Update (<a href=\"#swiftui-documentgroups-are-terribly-limited-update-2025-12-11\">2025-12-11<\/a>): <a href=\"https:\/\/aus.social\/@nighthawk\/115665713538128626\">Adrian Sch&ouml;nig<\/a>:<\/p>\n<blockquote cite=\"https:\/\/aus.social\/@nighthawk\/115665713538128626\">\n<p>A cautionary tale: I tried migrating a document-based app to SwiftUI&rsquo;s <code>DocumentGroup<\/code> and <code>ReferenceFileDocument<\/code>. Love the semantics and the code is simpler than with AppKit\/UIKit. Unfortunately you get a plethora of bugs. iOS doesn&rsquo;t save as some internal <code>EnvironmentObject<\/code> doesn&rsquo;t release the document when dismissing the view. Switching to <code>FileDocument<\/code> saves but the recently saved file disappears from the UI. visionOS has no way to get back to the list of documents after opening one. macOS works.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Christian Tietze: This is how little you need to get started[&#8230;][&#8230;]What the system does is provide a launch scene for you when you only declare a DocumentGroup in your SwiftUI.App.body. You can customize this by making the launch scene yourself. WWDC24 &ldquo;Evolve Your Document Launch Experience&rdquo; contains examples that at least offer to style what&rsquo;s [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2025-08-05T18:29:33Z","apple_news_api_id":"91cc7b92-5016-4c93-92e6-1eb66582d551","apple_news_api_modified_at":"2025-12-11T18:36:04Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAQ==","apple_news_api_share_url":"https:\/\/apple.news\/Akcx7klAWTJOS5h62ZYLVUQ","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[31,2741,1814,2763,30,2742,71,1812],"class_list":["post-48780","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-ios","tag-ios-26","tag-ipados","tag-ipados-26","tag-mac","tag-macos-tahoe-26","tag-programming","tag-swiftui"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/48780","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=48780"}],"version-history":[{"count":3,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/48780\/revisions"}],"predecessor-version":[{"id":50399,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/48780\/revisions\/50399"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=48780"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=48780"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=48780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}