<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thanks for the feedback, everyone! I’ve updated the&nbsp;<a href="https://github.com/SlaunchaMan/swift-evolution/blob/import-objc-constants/proposals/0000-import-objc-constants.md" class="">proposal</a>&nbsp;again to use both&nbsp;_attribute__((swift_wrapper(struct))) and&nbsp;__attribute__((swift_wrapper(struct))). Like Doug, I think having both fits the largest number of use cases.<div class=""><br class=""></div><div class="">I also changed the accessors on struct items to use var instead of let, which matches how option set types are imported.</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On Jan 29, 2016, at 1:48 PM, Douglas Gregor &lt;<a href="mailto:dgregor@apple.com" class="">dgregor@apple.com</a>&gt; wrote:</div><div class=""><div style="font-family: HelveticaNeue; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""></div></blockquote></div></div></blockquote><div class=""><div style="font-family: HelveticaNeue; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline"></div></blockquote></div></div><blockquote type="cite" class=""><div class=""><div style="font-family: HelveticaNeue; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="">I think you need to clarify a few things:</div><div class=""><br class=""></div><div class="">(1) How are the names of the constants transformed? It looks like you’re chopping off the common prefix between the type name and the enum constant name. Should the result have initial lowercase letters?</div></div></div></blockquote><div><br class=""></div><div>I’m removing both common prefixes and suffixes, if any. That way, both the “NS” and “ErrorDomain” of “NSErrorDomain” get chopped off. The initial result is uppercase to match existing imports (e.g. OptionSetType):</div><div><br class=""></div><div><span class="kt" style="border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145); font-family: Menlo, monospace; white-space: pre-wrap;">struct</span><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class=""> </span><span class="nl" style="border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; white-space: pre-wrap;">NSEnumerationOptions</span><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class=""> : </span><span class="n" style="border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(92, 38, 153); font-family: Menlo, monospace; white-space: pre-wrap;"><a href="file:///Users/jeff/Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.iOS.docset/Contents/Resources/Documents/documentation/Swift/Reference/Swift_OptionSetType_Protocol/index.html#//apple_ref/swift/intf/s:PSs13OptionSetType" data-renderer-version="2" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: inherit; text-decoration: none;" class="">OptionSetType</a></span><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class=""> {
    </span><span class="kt" style="border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145); font-family: Menlo, monospace; white-space: pre-wrap;">init</span><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class="">(</span><span class="nl" style="border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; white-space: pre-wrap;">rawValue</span><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class=""> </span><code class="code-voice" style="border: 0px; font-size: 12px; margin: 0px 0px 15px; outline: 0px; padding: 0px 0px 6px; vertical-align: baseline; font-family: Menlo, monospace; word-wrap: break-word; white-space: pre-wrap;"><em class="parameter-name" style="border: 0px; font-size: 0.92307em; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(65, 65, 65); line-height: 1.5;">rawValue</em></code><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class="">: </span><span class="n" style="border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(92, 38, 153); font-family: Menlo, monospace; white-space: pre-wrap;"><a href="file:///Users/jeff/Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.iOS.docset/Contents/Resources/Documents/documentation/Swift/Reference/Swift_UInt_Structure/index.html#//apple_ref/swift/struct/s:Su" data-renderer-version="2" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: inherit; text-decoration: none;" class="">UInt</a></span><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class="">)
    </span><span class="kt" style="border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145); font-family: Menlo, monospace; white-space: pre-wrap;">static</span><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class=""> </span><span class="kt" style="border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145); font-family: Menlo, monospace; white-space: pre-wrap;">var</span><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class=""> </span><span class="nl" style="border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; white-space: pre-wrap;">Concurrent</span><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class="">: </span><span class="n" style="border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(92, 38, 153); font-family: Menlo, monospace; white-space: pre-wrap;"><a href="file:///Users/jeff/Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.iOS.docset/Contents/Resources/Documents/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Constants/index.html#//apple_ref/swift/struct/c:@E@NSEnumerationOptions" data-renderer-version="2" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: inherit; text-decoration: none;" class="">NSEnumerationOptions</a></span><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class=""> { </span><span class="kt" style="border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145); font-family: Menlo, monospace; white-space: pre-wrap;">get</span><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class=""> }
    </span><span class="kt" style="border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145); font-family: Menlo, monospace; white-space: pre-wrap;">static</span><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class=""> </span><span class="kt" style="border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145); font-family: Menlo, monospace; white-space: pre-wrap;">var</span><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class=""> </span><span class="nl" style="border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Menlo, monospace; white-space: pre-wrap;">Reverse</span><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class="">: </span><span class="n" style="border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(92, 38, 153); font-family: Menlo, monospace; white-space: pre-wrap;"><a href="file:///Users/jeff/Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.iOS.docset/Contents/Resources/Documents/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Constants/index.html#//apple_ref/swift/struct/c:@E@NSEnumerationOptions" data-renderer-version="2" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: inherit; text-decoration: none;" class="">NSEnumerationOptions</a></span><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class=""> { </span><span class="kt" style="border: 0px; font-size: 12px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(170, 51, 145); font-family: Menlo, monospace; white-space: pre-wrap;">get</span><span style="font-family: Menlo, monospace; font-size: 12px; white-space: pre-wrap; background-color: rgb(255, 255, 255);" class=""> }
}</span></div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div style="font-family: HelveticaNeue; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="">(2) What happens if additional constants are defined in a different module? (I assume that the new “static let”s go into an extension)</div></div></div></blockquote><div><br class=""></div><div>I don’t <i class="">think</i>&nbsp;it’s possible for another module to add cases to an enum, so for those, we’d have to make them structs instead and use an extension. There’s an example of this for structs in the new proposal.</div><div><br class=""></div><div>Thanks for the feedback! This proposal is now better than ever.</div></div><div class=""><br class=""></div><br class=""><div class=""><div class=""><div style="font-family: Helvetica; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="line-height: normal; text-align: -webkit-auto; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="line-height: normal; text-align: -webkit-auto; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; line-height: normal; border-spacing: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Jeff Kelley</div><div class=""><br class=""></div><div class=""><a href="mailto:SlaunchaMan@gmail.com" class="">SlaunchaMan@gmail.com</a>&nbsp;|&nbsp;<a href="https://twitter.com/SlaunchaMan" class="">@SlaunchaMan</a>&nbsp;|&nbsp;<a href="http://jeffkelley.org" class="">jeffkelley.org</a></div></div></span></div></div></div></div><br class=""><div><blockquote type="cite" class=""></blockquote></div></div></body></html>