iOS Swift function with type () -> () -
im unable create function of type () -> () in swift xcode...
far im @
func successblock() -> void { //code return () }
but () not () -> ()
want function fit type () -> () because of function:
func logintofacebookwithsuccess(callingviewcontroller: uiviewcontroller, successblock: () -> (), andfailure failureblock: (nserror?) -> ()) {
gonna pass successblock() func variable in there.
i have same problem failureblock
or on wrong way?
thank you, spinhaxo
successblock
function.
need closures.
let successblock: () -> () = { // here... } let failureblock: (nserror?) -> () = { error in // error... }
if don't want store them, can define them while calling method this:
logintofacebookwithsuccess( callingcontroller, successblock: { // here... }, andfailure: { error in // error... } )
Comments
Post a Comment