I'm trying to create an object from a class that is passed on to a function of mine. The problem is that I'm unable to pass any arguments to its constructor because I can't seem to initialize
the class with parameters.
This is the code I have so far:
class func invokeService<T: Initable>(service: String, returningClass: T.Type, completionHandler handler: ((T) -> ())) {
var interfaceObject = returningClass()
interfaceObject.self(data: service as Dictionary <String, AnyObject>)
handler(interfaceObject)
}
This is the error I get:
'(data: Dictionary <String, AnyObject>)-> $T2' is not identical to 'T'