{"id":32284,"date":"2021-04-27T16:13:41","date_gmt":"2021-04-27T20:13:41","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=32284"},"modified":"2021-05-19T16:08:08","modified_gmt":"2021-05-19T20:08:08","slug":"swift-5-4-released","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2021\/04\/27\/swift-5-4-released\/","title":{"rendered":"Swift 5.4 Released"},"content":{"rendered":"<p><a href=\"https:\/\/swift.org\/blog\/swift-5-4-released\/\">Ted Kremenek<\/a>:<\/p>\n<blockquote cite=\"https:\/\/swift.org\/blog\/swift-5-4-released\/\"><p>Swift 5.4 includes the following new language features:<\/p><ul><li>Support for multiple variadic parameters in functions, subscripts and initializers <a href=\"https:\/\/github.com\/apple\/swift-evolution\/blob\/main\/proposals\/0284-multiple-variadic-parameters.md\">(SE-0284)<\/a><\/li><li>Extend implicit member syntax <a href=\"https:\/\/github.com\/apple\/swift-evolution\/blob\/main\/proposals\/0287-implicit-member-chains.md\">(SE-0287)<\/a><\/li><li>Result builders <a href=\"https:\/\/github.com\/apple\/swift-evolution\/blob\/main\/proposals\/0289-result-builders.md\">(SE-0289)<\/a><\/li><li>Local functions supporting overloading<\/li><li>Property wrappers for local variables<\/li><\/ul><p>[&#8230;]<\/p><p>In Swift 5.4, protocol conformance checks at runtime are significantly faster, thanks to a faster hash table implementation for caching previous lookup results.  In particular, this speeds up common runtime <code>as?<\/code> and <code>as!<\/code> casting operations.<\/p><\/blockquote>\n<p>This was slow enough that in a few cases I had worked around it by using an extension to introduce an instance method to do the test.<\/p>\n<blockquote cite=\"https:\/\/swift.org\/blog\/swift-5-4-released\/\">\n<p>The Swift compiler is much better at tracking dependencies between files, resulting in a significant reduction in the number of files compiled for many kinds of changes during incremental builds<\/p>\n<p>Dependencies on member variables and functions of structs, enums, classes, and protocols are now tracked individually by the Swift compiler. This finer granularity speeds and shrinks rebuilds after changes to these entities<\/p><\/blockquote>\n<p>There are code completion and type checking improvements, too.<\/p>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2021\/02\/02\/xcode-12-5-beta\/\">Xcode 12.5 Beta<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2020\/09\/17\/swift-5-3-released\/\">Swift 5.3 Released<\/a><\/li>\n<\/ul>\n\n<p id=\"swift-5-4-released-update-2021-05-19\">Update (2021-05-19): <a href=\"https:\/\/www.swiftbysundell.com\/tips\/same-name-assignments\/\">John Sundell<\/a>:<\/p>\n<blockquote cite=\"https:\/\/www.swiftbysundell.com\/tips\/same-name-assignments\/\">\n<p>It&rsquo;s now possible to create a local variable that&rsquo;s assigned to an expression that has the same name, without having to manually disambiguate with <code>self<\/code>.<\/p>\n<\/blockquote>\n<p>That was a common annoyance for me.<\/p>","protected":false},"excerpt":{"rendered":"<p>Ted Kremenek: Swift 5.4 includes the following new language features:Support for multiple variadic parameters in functions, subscripts and initializers (SE-0284)Extend implicit member syntax (SE-0287)Result builders (SE-0289)Local functions supporting overloadingProperty wrappers for local variables[&#8230;]In Swift 5.4, protocol conformance checks at runtime are significantly faster, thanks to a faster hash table implementation for caching previous lookup results. [&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-04-27T20:13:44Z","apple_news_api_id":"fa976b10-620f-4f88-9564-592681bf3221","apple_news_api_modified_at":"2021-05-19T20:08:15Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAQ==","apple_news_api_share_url":"https:\/\/apple.news\/A-pdrEGIPT4iVZFkmgb8yIQ","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":[255,46,138,71,901,226],"class_list":["post-32284","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-compiler","tag-languagedesign","tag-optimization","tag-programming","tag-swift-programming-language","tag-xcode"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/32284","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=32284"}],"version-history":[{"count":3,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/32284\/revisions"}],"predecessor-version":[{"id":32524,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/32284\/revisions\/32524"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=32284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=32284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=32284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}