Hi,
To Create a extension class in swift Please follow the steps below.
1- Add a new Swift file in your project and add the following code
import Foundation
//MySingltonClassSwift is a singletonClass or you can use any class for which you want to create a extesion
extension MySingletonClassSwift{
func mytestMethod(name:NSString)
{
print("Called method here\(name)")
}
}
To call the mytestMethod(name:NSString) .
MySingletonClassSwift.sharedInstance.mytestMethod("test arument")
0 Comment(s)