I have a protocol in Swift :
protocol FooConvertible{ typealias FooType init(foo: FooType) }
I can make Swift classes match it in the class definition:
class Bar: FooConvertible { var baz: String = "" required init(foo: String){ baz = foo } }
So far so good. However, the problem arises when I try to make the class compatible with it in the extension (with Cocoa classes, this is my only option, since I have no source):
class Baz { var baz = "" } extension Baz: FooConvertible{ required convenience init(foo: String) {
This one was available in previous versions of the language.
What is the reason for its removal?
This would mean that all XXXLiteralConvertible Protocols are forbidden from Cocoa classes!
source share