{"id":53372,"date":"2026-09-30T16:45:13","date_gmt":"2026-09-30T20:45:13","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=53372"},"modified":"2026-09-30T16:45:13","modified_gmt":"2026-09-30T20:45:13","slug":"backporting-swiftui-apis","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2026\/09\/30\/backporting-swiftui-apis\/","title":{"rendered":"Backporting SwiftUI APIs"},"content":{"rendered":"<p><a href=\"https:\/\/davedelong.com\/blog\/2022\/05\/15\/conditional-compilation-part-4-deployment-targets\/\">Dave DeLong<\/a>:<\/p>\n<blockquote cite=\"https:\/\/davedelong.com\/blog\/2022\/05\/15\/conditional-compilation-part-4-deployment-targets\/\">\n<p>I can improve the process of <em>removing<\/em> backwards compatibility shims by using conditional compilation to remind me when they&rsquo;re no longer necessary!<\/p>\n<p>[&#8230;]<\/p>\n<p>This does mean that the first time we change our deployment target, we&rsquo;ll get a bunch of compilation errors. But given the nature of how <code>Backport<\/code> is implemented, this should be a relatively quick process to move past. (And of course, you&rsquo;re welcome to use <code>#warning<\/code> instead of <code>#error<\/code>).<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/github.com\/shaps80\/SwiftUIBackports\">Shaps Benkau<\/a>:<\/p>\n<blockquote cite=\"https:\/\/github.com\/shaps80\/SwiftUIBackports\">\n<p>SwiftUIBackports mirrors Apple&rsquo;s SwiftUI API names, shapes, behavior, documentation, and availability where practical. This keeps app code familiar today, and easy to migrate away from once your deployment target reaches the native API.<\/p>\n<p>Backports are discovered through <code>.backport<\/code>, the <code>Backport<\/code> namespace, or <code>backport<\/code>-prefixed environment values.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/swiftwithmajid.com\/2026\/09\/22\/backporting-swiftui-apis\/\">Majid Jabrayilov<\/a>:<\/p>\n<blockquote cite=\"https:\/\/swiftwithmajid.com\/2026\/09\/22\/backporting-swiftui-apis\/\">\n<p>Usually, we don&rsquo;t see many new APIs in intermediate releases like 27.1, but this time is different. Apple introduced several new iPhone Duo-related APIs in the 27.1 release. This week, we will learn how to use all of these new APIs without bumping your project&rsquo;s target version.<\/p>\n<p>[&#8230;]<\/p>\n<p>Here we introduced the <code>toolbarVerticalBehavior<\/code> function on the <code>Backport<\/code> type that handles availability checks and calls the new APIs if available or returns a plain view when it is not available.<\/p>\n<\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2026\/09\/11\/developing-for-iphone-duo\/\">Developing for iPhone Duo<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2026\/09\/08\/swiftui-toolbars\/\">SwiftUI Toolbars<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2026\/06\/19\/swiftui-in-appleos-27\/\">SwiftUI in appleOS 27<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2021\/10\/11\/simplifying-backwards-compatibility-in-swift\/\">Simplifying Backwards Compatibility in Swift<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Dave DeLong: I can improve the process of removing backwards compatibility shims by using conditional compilation to remind me when they&rsquo;re no longer necessary! [&#8230;] This does mean that the first time we change our deployment target, we&rsquo;ll get a bunch of compilation errors. But given the nature of how Backport is implemented, this should [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2026-09-30T20:45:18Z","apple_news_api_id":"81e270d9-3055-4218-bd3c-9292e850157b","apple_news_api_modified_at":"2026-09-30T20:45:18Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AgeJw2TBVQhi9PJKS6FAVew","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,2887,2966,30,2784,74,71,901,1812],"class_list":["post-53372","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-ios","tag-ios-27","tag-iphone-duo","tag-mac","tag-macos-27","tag-opensource","tag-programming","tag-swift-programming-language","tag-swiftui"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/53372","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=53372"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/53372\/revisions"}],"predecessor-version":[{"id":53373,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/53372\/revisions\/53373"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=53372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=53372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=53372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}