Look for Disjunctions (logical ORs) in type constraints. ;) It’s rejected.
-- Adrian Zubarev Sent with Airmail Am 2. Februar 2017 um 22:26:44, Rex Fenley via swift-evolution (swift-evolution@swift.org) schrieb: Hello, I believe there was some discussion about this quite awhile ago. I was wondering if there's any interest in including a protocol 'or' type that would be the intersection of two protocols. This could be really useful in situations where a framework that the user has no control over implements a portion of some often used protocol. Such as specialized collections from an Database framework that don't implement RangeReplaceableCollection but have a set of methods that are equivalent. The user can then implement a protocol that is the intersection of those set of methods and not duplicate code. Simplified example: protocol Animal { var hasEars: Bool { get } func grow() } protocol Plant { var isGreen: Bool { get } func grow() } protocol LivingThing = Plant | Animal // or a different syntax LivingThing's is as follows { func grow() } -- Rex Fenley | IOS DEVELOPER Remind.com | BLOG | FOLLOW US | LIKE US _______________________________________________ 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