Protocol can only be used as a generic constraint because it has Self or associatedType requirements

Suppose for the moment we adjust your protocol to add a routine that uses the associated type: public protocol RequestType: class { associatedtype Model var path: String { get set } func frobulateModel(aModel: Model) } And Swift were to let you create an array of RequestType the way you want to. I could pass an … Read more

How to define optional methods in Swift protocol?

1. Using default implementations (preferred). protocol MyProtocol { func doSomething() } extension MyProtocol { func doSomething() { /* return a default value or just leave empty */ } } struct MyStruct: MyProtocol { /* no compile error */ } Advantages No Objective-C runtime is involved (well, no explicitly at least). This means you can conform … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)