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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -