{"id":35098,"date":"2022-02-22T15:25:02","date_gmt":"2022-02-22T20:25:02","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=35098"},"modified":"2022-05-05T13:44:36","modified_gmt":"2022-05-05T17:44:36","slug":"swift-5-6-features-in-xcode-13-3-beta-3","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2022\/02\/22\/swift-5-6-features-in-xcode-13-3-beta-3\/","title":{"rendered":"Swift 5.6 Features in Xcode 13.3 Beta 3"},"content":{"rendered":"<p><a href=\"https:\/\/developer.apple.com\/documentation\/xcode-release-notes\/xcode-13_3-release-notes\">Apple<\/a>:<\/p>\n<blockquote cite=\"https:\/\/developer.apple.com\/documentation\/xcode-release-notes\/xcode-13_3-release-notes\"><p>Swift now allows existential types written with the <code>any<\/code> keyword. An existential type is a type that can hold a value of any type conforming to a specific protocol. The <code>any<\/code> keyword creates a syntactic distinction between existential types and protocol conformance constraints. The <code>any<\/code> keyword is an important syntactic indicator that you&rsquo;re using an existential type, because there are fundamental limitations on the capabilities of these types, such as the inability to conform to protocols. [<a href=\"https:\/\/github.com\/apple\/swift-evolution\/blob\/main\/proposals\/0335-existential-any.md\">SE-0335<\/a>]<\/p><p>[&#8230;]<\/p><p>Swift now provides an incremental migration path for data race safety. APIs can adopt concurrency without breaking clients that haven&rsquo;t adopted concurrency. An existing declaration can introduce concurrency-related annotations (such as making its closure parameters <code>@Sendable<\/code>) and use the <code>@preconcurrency<\/code> attribute to maintain its behavior for clients who haven&rsquo;t adopted concurrency[&#8230;] [<a href=\"https:\/\/github.com\/apple\/swift-evolution\/blob\/main\/proposals\/0337-support-incremental-migration-to-concurrency-checking.md\">SE-0337<\/a>]<\/p><p>[&#8230;]<\/p>\n<p>The standard library now provides the <a href=\"https:\/\/developer.apple.com\/documentation\/swift\/3917377-withunsafetemporaryallocation\"><code>withUnsafeTemporaryAllocation(of:capacity:_:)<\/code><\/a> and <a href=\"https:\/\/developer.apple.com\/documentation\/swift\/3917376-withunsafetemporaryallocation\"><code>withUnsafeTemporaryAllocation(byteCount:alignment:_:)<\/code><\/a> functions. You can use these functions to cheaply allocate raw storage for a brief duration. The system allocates storage on the stack if possible. [<a href=\"https:\/\/github.com\/apple\/swift-evolution\/blob\/main\/proposals\/0322-temporary-buffers.md\">SE-0322<\/a>]<\/p><\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2021\/12\/15\/xcode-13-2\/\">Xcode 13.2<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2021\/10\/28\/swift-concurrency-for-older-os-versions\/\">Swift Concurrency for Older OS Versions<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2021\/09\/21\/swift-5-5-released\/\">Swift 5.5 Released<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2019\/04\/10\/improving-the-ui-of-swift-generics\/\">Improving the UI of Swift Generics<\/a><\/li>\n<\/ul>\n\n<p id=\"swift-5-6-features-in-xcode-13-3-beta-3-update-2022-03-07\">Update (2022-03-07): <a href=\"https:\/\/www.hackingwithswift.com\/articles\/247\/whats-new-in-swift-5-6\">Paul Hudson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/www.hackingwithswift.com\/articles\/247\/whats-new-in-swift-5-6\">\n<p>Swift 5.6 introduces another barrage of new features to the language, while refining others as we get closer to Swift 6. In this article I want to introduce you to the major changes, providing some hands-on examples along the way so you can see for yourself what&rsquo;s changing.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Apple: Swift now allows existential types written with the any keyword. An existential type is a type that can hold a value of any type conforming to a specific protocol. The any keyword creates a syntactic distinction between existential types and protocol conformance constraints. The any keyword is an important syntactic indicator that you&rsquo;re using [&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":"2022-02-22T20:25:05Z","apple_news_api_id":"e02b8743-fb0f-484a-a4c5-cea98468b75b","apple_news_api_modified_at":"2022-05-05T17:44:48Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAg==","apple_news_api_share_url":"https:\/\/apple.news\/A4CuHQ_sPSEqkxc6phGi3Ww","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":[800,31,2078,46,30,2077,71,2200,901,226],"class_list":["post-35098","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-concurrency","tag-ios","tag-ios-15","tag-languagedesign","tag-mac","tag-macos-12","tag-programming","tag-swift-concurrency","tag-swift-programming-language","tag-xcode"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/35098","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=35098"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/35098\/revisions"}],"predecessor-version":[{"id":35196,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/35098\/revisions\/35196"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=35098"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=35098"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=35098"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}