Thursday, October 15, 2015 [Tweets] [Favorites]

Swift Casting With _ObjectiveCBridgeable

Rafael Machado:

The documentation, which is only founded in header files says:

A Swift Array or Dictionary of types conforming to ObjectiveCBridgeable can be passed to Objective-C as an NSArray or NSDictionary, respectively. The elements of the resulting NSArray or NSDictionary will be the result of calling bridgeToObjectiveC on each element of the source container.

But this is not limited to the standard collection types. It can also be used to cast an Objective-C object to a Swift struct.

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment