{"id":33319,"date":"2021-08-04T16:09:29","date_gmt":"2021-08-04T20:09:29","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=33319"},"modified":"2021-08-04T16:09:29","modified_gmt":"2021-08-04T20:09:29","slug":"lists-of-swift-attributes","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2021\/08\/04\/lists-of-swift-attributes\/","title":{"rendered":"Lists of Swift Attributes"},"content":{"rendered":"<p><a href=\"https:\/\/docs.swift.org\/swift-book\/ReferenceManual\/Attributes.html\">Swift Language Reference<\/a>:<\/p>\n<blockquote cite=\"https:\/\/docs.swift.org\/swift-book\/ReferenceManual\/Attributes.html\"><p>There are two kinds of attributes in Swift&mdash;those that apply to declarations and those that apply to types. An attribute provides additional information about the declaration or type. For example, the <code>discardableResult<\/code> attribute on a function declaration indicates that, although the function returns a value, the compiler shouldn&rsquo;t generate a warning if the return value is unused.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/github.com\/apple\/swift\/blob\/main\/docs\/ReferenceGuides\/UnderscoredAttributes.md\">Underscored Attributes Reference<\/a> (via <a href=\"https:\/\/twitter.com\/slava_pestov\/status\/1422963307212849152\">Slava Pestov<\/a>):<\/p>\n<blockquote cite=\"https:\/\/github.com\/apple\/swift\/blob\/main\/docs\/ReferenceGuides\/UnderscoredAttributes.md\"><p>This document is intended to serve as a counterpart describing underscored attributes, whose semantics are subject to change and most likely need to go through the Swift evolution process before being stabilized.<\/p><\/blockquote>\n\n<p>There are also <code>@inline(__always)<\/code> and <code>@inline(never)<\/code>, which are not documented above, but which are discussed <a href=\"https:\/\/forums.swift.org\/t\/when-should-both-inlinable-and-inline-always-be-used\/37375\">here<\/a> and <a href=\"https:\/\/swiftrocks.com\/the-forbidden-inline-attribute-in-swift\">here<\/a>.<\/p>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2021\/04\/12\/high-performance-numeric-programming-with-swift\/\">High Performance Numeric Programming With Swift<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Swift Language Reference: There are two kinds of attributes in Swift&mdash;those that apply to declarations and those that apply to types. An attribute provides additional information about the declaration or type. For example, the discardableResult attribute on a function declaration indicates that, although the function returns a value, the compiler shouldn&rsquo;t generate a warning if [&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-08-04T20:09:33Z","apple_news_api_id":"d4dc81d3-cd69-402b-8732-a8e523a99fff","apple_news_api_modified_at":"2021-08-04T20:09:33Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/A1NyB081pQCuHMqjlI6mf_w","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":[46,71,901],"class_list":["post-33319","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-languagedesign","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/33319","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=33319"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/33319\/revisions"}],"predecessor-version":[{"id":33320,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/33319\/revisions\/33320"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=33319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=33319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=33319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}