title: Declaring and using custom attributes in Swift
body: <p>I would like to be able to annotate my types and methods with meta-data and read those at runtime. </p>
  
  <p>The language reference explains <a href="https://developer.apple.com/library/prerelease/ios/documentation/swift/conceptual/swift_programming_language/Attributes.html#//apple_ref/doc/uid/TP40014097-CH35-XID_460" rel="noreferrer">how to declare attribute usages</a>, but is it actually possible to declare your own attributes? </p>
  
  <p>Reading would require some kind of reflection mechanism, which I was not able to find in the reference at all, so the second part of the question probably is - is there reflection possible. If these features are not available in Swift, can they be done with Objective-C code (but on Swift instances and types)?</p>
  
  <p>A relatively unrelated note: The decision of what has been modelled as an attribute and what has been added to the core syntax strikes me as pretty arbitrary. It feels like two different teams worked on the syntax and on some attributes. E.g. they put <a href="https://developer.apple.com/library/prerelease/ios/documentation/swift/conceptual/swift_programming_language/AutomaticReferenceCounting.html#//apple_ref/doc/uid/TP40014097-CH20-XID_50" rel="noreferrer"><code>weak</code> and <code>unowned</code></a> into the language as modifiers, but made <a href="https://developer.apple.com/library/prerelease/ios/documentation/swift/conceptual/swift_programming_language/Attributes.html#//apple_ref/doc/uid/TP40014097-CH35-XID_460" rel="noreferrer"><code>@final</code> and <code>@lazy</code></a> attributes. I believe that once they actually add access modifiers, they will probably be attributes likes <code>final</code>. Is all of this somehow related to Objective-C interoperability?</p>