{"id":33704,"date":"2021-09-21T16:59:19","date_gmt":"2021-09-21T20:59:19","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=33704"},"modified":"2022-05-05T13:45:13","modified_gmt":"2022-05-05T17:45:13","slug":"swift-5-5-released","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2021\/09\/21\/swift-5-5-released\/","title":{"rendered":"Swift 5.5 Released"},"content":{"rendered":"<p><a href=\"https:\/\/swift.org\/blog\/swift-5-5-released\/\">Ted Kremenek<\/a>:<\/p>\n<blockquote cite=\"https:\/\/swift.org\/blog\/swift-5-5-released\/\"><p>Swift 5.5 is a massive release, which includes newly introduced language capabilities for concurrency, including <code>async\/await<\/code>, structured concurrency, and Actors.<\/p><p>[&#8230;]<\/p><ul><li>SE-0293 <a href=\"https:\/\/github.com\/apple\/swift-evolution\/blob\/main\/proposals\/0293-extend-property-wrappers-to-function-and-closure-parameters.md\">Extend Property Wrappers to Function and Closure Parameters<\/a><\/li><li>SE-0295 <a href=\"https:\/\/github.com\/apple\/swift-evolution\/blob\/main\/proposals\/0295-codable-synthesis-for-enums-with-associated-values.md\">Codable synthesis for enums with associated values<\/a><\/li><\/ul><p>[&#8230;]<\/p><ul><li>SE-0307 <a href=\"https:\/\/github.com\/apple\/swift-evolution\/blob\/main\/proposals\/0307-allow-interchangeable-use-of-double-cgfloat-types.md\">Allow interchangeable use of CGFloat and Double types<\/a><\/li><li>SE-0308 <a href=\"https:\/\/github.com\/apple\/swift-evolution\/blob\/main\/proposals\/0308-postfix-if-config-expressions.md\">if for postfix member expressions<\/a><\/li><\/ul><\/blockquote>\n\n<p><a href=\"https:\/\/www.swiftbysundell.com\/articles\/codable-synthesis-for-swift-enums\/\">John Sundell<\/a>:<\/p>\n<blockquote cite=\"https:\/\/www.swiftbysundell.com\/articles\/codable-synthesis-for-swift-enums\/\">\n<p>Before Swift 5.5, if we wanted to make an enum that contains associated values conform to <code>Codable<\/code>, then we&rsquo;d have to write all of that code manually. However, that&rsquo;s no longer the case, as the compiler has received an upgrade that now makes it capable of auto-synthesizing serialization code for such enums as well.<\/p>\n<p>[&#8230;]<\/p>\n<p>If needed, we could even customize what keys that are used for the associated values within a specific case. For example, here&rsquo;s how we could declare that we&rsquo;d like the youTube case&rsquo;s id value to be serialized as youTube<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/swiftbysundell.com\/articles\/conditional-compilation-within-swift-expressions\/\">John Sundell<\/a> (<a href=\"https:\/\/twitter.com\/johnsundell\/status\/1433732517866188814\">tweet<\/a>):<\/p>\n<blockquote cite=\"https:\/\/swiftbysundell.com\/articles\/conditional-compilation-within-swift-expressions\/\"><p>In general, these kinds of issues can be worked around using a compile-time platform check &mdash; but before Swift 5.5, we&rsquo;d have to first break our <code>List<\/code> out into a separate expression, and then apply different <code>listStyle<\/code> modifiers separately using an <code>#if<\/code>-based operating system condition[&#8230;]<\/p>\n<p>[&#8230;]<\/p>\n<p>When using Swift 5.5, we now have the option to inline <code>#if<\/code> directives right within our expressions. So, going back to our <code>ItemList<\/code>, we can now conditionally apply each of our <code>listStyle<\/code> modifiers completely inline &mdash; without first having to break our expression up into multiple parts[&#8230;]<\/p><\/blockquote>\n\n<p><a href=\"http:\/\/www.figure.ink\/blog\/2021\/6\/13\/cleaning-up-async-without-swift-55\">Joshua Emmons<\/a>:<\/p>\n<blockquote cite=\"http:\/\/www.figure.ink\/blog\/2021\/6\/13\/cleaning-up-async-without-swift-55\">\n<p>Sadly, these [async\/await] features require runtime support. Which means, at least for the time being, <a href=\"https:\/\/forums.swift.org\/t\/will-swift-concurrency-deploy-back-to-older-oss\/49370\/4\">async is iOS 15-\/macOS 12-only<\/a>.<\/p>\n<p>For those of us supporting older deployment targets, this can be a bit of a let down. But not all hope is lost! We can build clean, flattened-out async handling on our own.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/forums.swift.org\/t\/optimizing-and-debugging-incremental-build-time-in-swift-5-5\/49379\">David Ungar<\/a>:<\/p>\n<blockquote cite=\"https:\/\/forums.swift.org\/t\/optimizing-and-debugging-incremental-build-time-in-swift-5-5\/49379\">\n<p>If your incremental (i.e. Debug) builds seem to be too slow, here some things to try[&#8230;]<\/p>\n<\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2021\/09\/15\/creating-compile-time-reminders-in-xcode\/\">Creating Compile-Time Reminders in Xcode<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2021\/09\/14\/xcode-13-rc\/\">Xcode 13 RC<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2021\/04\/27\/swift-5-4-released\/\">Swift 5.4 Released<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2021\/03\/18\/swift-proposal-actors\/\">Swift Proposal: Actors<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2021\/01\/20\/swift-asyncsequence\/\">Swift AsyncSequence<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2020\/12\/11\/swift-concurrency-interoperability-with-objective-c\/\">Swift Concurrency Interoperability With Objective-C<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2020\/12\/07\/swift-proposal-for-async-await\/\">Swift Proposal for async\/await<\/a><\/li>\n<\/ul>\n\n<p id=\"swift-5-5-released-update-2021-10-05\">Update (2021-10-05): <a href=\"https:\/\/forums.swift.org\/t\/swift-5-5-has-serious-stack-corruption-bugs\/52344\">taylorswift<\/a>:<\/p>\n<blockquote cite=\"https:\/\/forums.swift.org\/t\/swift-5-5-has-serious-stack-corruption-bugs\/52344\">\n<p>I&rsquo;ve discovered several stack corruption bugs related to <code>async<\/code>\/<code>await<\/code> which can be reproduced in simple test programs compiled with recent nightly toolchains. i have confirmed that four of these bugs are present in the 5.5-RELEASE toolchain.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Ted Kremenek: Swift 5.5 is a massive release, which includes newly introduced language capabilities for concurrency, including async\/await, structured concurrency, and Actors.[&#8230;]SE-0293 Extend Property Wrappers to Function and Closure ParametersSE-0295 Codable synthesis for enums with associated values[&#8230;]SE-0307 Allow interchangeable use of CGFloat and Double typesSE-0308 if for postfix member expressions John Sundell: Before Swift 5.5, [&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":"2021-09-21T20:59:24Z","apple_news_api_id":"f8c9cb99-2e4d-4b01-903e-5a77f46cb014","apple_news_api_modified_at":"2022-05-05T17:45:33Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAQ==","apple_news_api_share_url":"https:\/\/apple.news\/A-MnLmS5NSwGQPlp39GywFA","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":[131,255,800,46,138,71,1774,2200,901,1812],"class_list":["post-33704","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-bug","tag-compiler","tag-concurrency","tag-languagedesign","tag-optimization","tag-programming","tag-swift-codable","tag-swift-concurrency","tag-swift-programming-language","tag-swiftui"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/33704","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=33704"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/33704\/revisions"}],"predecessor-version":[{"id":33830,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/33704\/revisions\/33830"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=33704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=33704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=33704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}