Xcode iOS Swift: Auto Generate Protocol Function Overrides
Is there a way for Xcode to automatically generate protocol functions for you to make your class conform to your protocol? For example:
My protocol:
protocol ProtocolDownloadFile {
func fileReturned(file: NSDictionary, metaData: String)
func connectionError(connectionError: ConnectionError)
}
If I implement this class:
class NetworkController: NSObject {
}
and specify the protocol:
class NetworkController: NSObject, ProtocolDownloadFile {
}
I want my class to automatically inject functions for me like:
class NetworkController: NSObject, ProtocolDownloadFile {
//I want these to be automatically generated
func fileReturned(file: NSDictionary, metaData: String) {
}
func connectionError(connectionError: ConnectionError) {
}
}
Can Xcode do this for me? I can see that if I have a Protocol with many functions, it will take some time to write them all. Its the same functionality as Eclipse, implementing an interface in Java.
+3
source to share
No one has answered this question yet
Check out similar questions: