NSRect and CGRect are already the same type and can be used interchangeably:

> typedef CGRect NSRect;


You can easily typealias CGRect to Rect as well if you don't like the 
two-letter prefix. Otherwise, if you can wait a bit, SE-0005 
<https://github.com/apple/swift-evolution/blob/master/proposals/0005-objective-c-name-translation.md>
 will probably do it for you since it should remove the NS prefix 
<https://github.com/apple/swift-evolution/blob/master/proposals/0005-objective-c-name-translation.md#stripping-the-ns-prefix>
 on Foundation APIs.

I'm ot particularly enthusiastic about the suggested Frame and Bounds 
typealiases though. You could still assign a Bounds to a Frame so I don't think 
that there's a big win here.

Félix

> Le 6 janv. 2016 à 00:10:31, John Randolph via swift-evolution 
> <[email protected]> a écrit :
> 
> Sorry if this is a repeat, but I’d like to suggest promoting certain structs 
> from Foundation to the Swift standard library.
> 
> As an OS X and iOS developer, it sometimes seems that I work with 
> [GG|NS]Point, [GG|NS]Rect, and [GG|NS]Size almost as much as I use Float or 
> String.  I’d love to see Swift’s standard library include Rect, Point, and 
> Size types, with bridging to make them “just work” with any UIKit or AppKit 
> API that expects their NS or CG equivalents.  Maybe also typealias Frame and 
> Bounds to Rect while we’re at it.
> 
> Thoughts?
> 
> -jcr
> 
> 
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to