[swift-evolution] Objective-C’s @compatibility_alias => Swift’s typealias?
sean at fifthace.com
Thu Jun 30 17:59:45 CDT 2016
Makes sense to me!
Sent from my iPad
> On Jun 30, 2016, at 5:16 PM, Ayaka Nonaka via swift-evolution <swift-evolution at swift.org> wrote:
> Hi Swift community,
> I was wondering if bridging Objective-C’s @compatibility_alias to Swift’s typealias is something that we have considered adding support for.
> For example, @compatibility_alias is useful for things like adding an alias like DCColor for UIColor and NSColor depending on the target. Here’s an example from our codebase:
> // For color compatibility, we alias DCColor to the appropriate class
> #if DC_TARGET_MOBILE
> #import <UIKit/UIKit.h>
> @compatibility_alias DCColor UIColor;
> #import <Cocoa/Cocoa.h>
> @compatibility_alias DCColor NSColor;
> We expected DCColor 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 @compatibility_alias for similar things and other things that are useful. It would be really cool to see seamless bridging between @compatibility_alias and typealias, especially since we’ve seen a lot of other great backwards compatibility features in Swift 3.0 like importing lightweight-generics and #keyPath.
> Thanks for reading! :D
> Ayaka Nonaka
> @ayanonagon | www.ayaka.me
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution