[swift-evolution] [Pitch] Making some RawRepresentable things bridge to ObjC as their raw value

Brent Royal-Gordon brent at architechies.com
Sun Oct 2 21:38:49 CDT 2016


> On Oct 2, 2016, at 3:46 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> Do you mind providing some color on this design? It seems to me that
>> the proposal's ObjectiveCBridgeable design was both more idiomatic
> 
> How so?

I mean merely that, when asked "How do I create a new instance from some data?", Swift's preferred answer is "Write an initializer", and thus `init?(bridgedFromObjectiveC: ObjectiveCType)` is a more natural solution than `static func bridged<Policy: BridgePolicy>(from: ObjectiveCType, by: Policy.Type) -> Self?`. Obviously this is a mere style concern and should be ignored if there are good reasons to use the other design, but it seems to me that it deserves at least a little bit of weight.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list