=D

We’re already discussing this in a looooot (I mean really lot) different 
threads.

Search for existentials or Any<…> or type<…> or All<…>.

SE–0095 is the first step in that direction. We want a shorthand version first 
and design a more complex functionality like Any<…> later.

Any<UIViewController, Protocol1, Protocol2> (I prefer this one)
or Any<UIViewController & Protocol1 & Protocol2>
After Swift 3 will drop I’ll submit a proposal for class-requirement for the 
shorthand version: UIViewController & Protocol1 & Protocol2 or a type alias: 
typealias CustomConstrainedController = UIViewController & Protocol1 & Protocol2


-- 
Adrian Zubarev
Sent with Airmail

Am 14. Juni 2016 um 18:59:54, Adrian Śliwa via swift-evolution 
(swift-evolution@swift.org) schrieb:

Hi all,

In Obj-C we have:
@property UIViewController<Protocol1, Protocol2, ...> *viewController;
Is there any reason we don't have in Swift:
var viewController: UViewController<Protocol1, Protocol2, ...>
Do you think it will be nice feature to have in Swift?
One example I have is is to have VC's container with view controllers(some 
forms) which implement Validable protocol to enforce them to have 
implementation of this method and to prevent situation that there is somewhere 
default implementation of the method "isValid" e.g. in superclass or protocol 
extension.
What are your thoughts?

Cheers,
Adrian
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to