Wednesday, 8 April 2015

a rubbish language -- swift, no parameter and returns void closure issue

If you have closure without parameters and return void, the closure is:

()->()   // this first "()" means no parameters the second "()" means return void.

when you define a function as a function's parameter, you can also do like this:

func xxx (anotherFunc: fn ()->()){

Back to my topic "in case of closure without parameter and returns void", and you only have one line of code, like this

                KVNProgress.showSuccessWithStatus(ALERT_COLLECTED_ALL,completion: {
                    ()->() in


you will have a stupid error from the stupid xcode:

This stupid error can be fixed by adding one println("stupid xcode"):

or, you change your code to 2 lines:

                    let navigator = self.navigationController!


No comments:

Post a comment