In Objective-C, it\'s possible to specify a class conforming to a protocol as a method parameter. For example, I could have a method that only allows a UIViewControlle
Note in September 2015: This was an observation in the early days of Swift.
It seems to be impossible. Apple has this annoyance in some of their APIs as well. Here is one example from a newly introduced class in iOS 8 (as of beta 5):
UIInputViewController
's textDocumentProxy
property:
Defined in Objective-C as follows:
@property(nonatomic, readonly) NSObject *textDocumentProxy;
and in Swift:
var textDocumentProxy: NSObject! { get }
Link to Apple' documentation: https://developer.apple.com/library/prerelease/iOS/documentation/UIKit/Reference/UIInputViewController_Class/index.html#//apple_ref/occ/instp/UIInputViewController/textDocumentProxy