Swift - Write program to implement a Protocol

Requirements

Consider the following protocol:

protocol SampleProtocol {
    init(someProperty1:String)
    var someProperty1:String {get set}
    var someProperty2:Int {get set}
    func myFunction()
}

Create a class named SomeClass that conforms to SampleProtocol.


class SomeClass:SampleProtocol {
     var someProperty1:String
     var someProperty2 :Int

     required init(someProperty1:String) {
         self.someProperty1 = someProperty1
         self.someProperty2 = 0
     }

     func myFunction() {
     }
}

Related Topic