+ 2
Is there interface in Swift? How to use interface?
3 Respostas
+ 2
Yes, but in swift they are called Protocols.
Protocols in Swift are very similar to Objc, except you may use them not only on classes, but also on structs and enums.
this is an example:-
protocol SomeProtocol{var fullName:String{get}// You can require iVarsclass func someTypeMethod()// ...or class methods}
Conforming to a protocol is a bit different:
class myClass:NSObject,SomeProtocol// Specify protocol(s) after the class type
Hope you like my answer
+ 1
thank you so much.
i'll continue learning on it.
0
Yeah! Swift is fun