<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>+1 for Swift 3.<br><br>Sent from my iPhone</div><div><br>On 1 Jul 2016, at 04:08, Douglas Gregor via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 30, 2016, at 3:16 PM, Ayaka Nonaka via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Swift community,<blockquote style="margin:0 0 0 40px;border:none;padding:0px" class=""><div class=""><br class=""></div></blockquote><div class="">I was wondering if bridging Objective-C’s <font face="monospace, monospace" class="">@compatibility_alias</font> to Swift’s <font face="monospace, monospace" class="">typealias</font><font face="arial, helvetica, sans-serif" class=""> is something that we have considered adding support for.</font></div><div class=""><br class=""></div><div class=""><font face="arial, helvetica, sans-serif" class="">For example, </font><span style="font-family:monospace,monospace" class="">@compatibility_alias </span><font face="arial, helvetica, sans-serif" class="">is useful for things like adding an alias like </font><font face="monospace, monospace" class="">DCColor</font><font face="arial, helvetica, sans-serif" class=""> for </font><font face="monospace, monospace" class="">UIColor</font><font face="arial, helvetica, sans-serif" class=""> and </font><font face="monospace, monospace" class="">NSColor</font><font face="arial, helvetica, sans-serif" class=""> depending on the target. Here’s an example from our codebase:</font></div><div class=""><font face="arial, helvetica, sans-serif" class=""><br class=""></font></div><font face="monospace, monospace" class="">// For color compatibility, we alias DCColor to the appropriate class<br class="">#if DC_TARGET_MOBILE<br class="">#import <UIKit/UIKit.h><br class="">@compatibility_alias DCColor UIColor;<br class="">#else<br class="">#import <Cocoa/Cocoa.h><br class="">@compatibility_alias DCColor NSColor;<br class="">#endif</font><div class=""><font face="monospace, monospace" class=""><br class=""></font></div><div class="">We expected <font face="monospace, monospace" class="">DCColor</font> to be exposed to our Swift code, but it turns out that it is not. I’d imagine that we’re not the only ones using <span style="font-family:monospace,monospace" class="">@compatibility_alias</span><font face="arial, helvetica, sans-serif" class=""> for similar things and other things that are useful. It would be really cool to see seamless bridging between </font><font face="monospace, monospace" class="">@compatibility_alias</font> and <font face="monospace, monospace" class="">typealias</font>, especially since we’ve seen a lot of other great backwards compatibility features in Swift 3.0 like importing lightweight-generics and <font face="monospace, monospace" class="">#keyPath</font>.</div></div></div></blockquote><br class=""></div><div>It definitely makes sense for @compatibility_alias to map to ‘typealias’, and I’d consider it a bug fix that doesn’t need a proposal. Thanks for bringing this up! I had no idea anyone knew about or used @compatibility_alias...</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>- Doug</div><div><br class=""></div><br class=""></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>