I want to clear about Nested Closures in Swift 2.1
Here I declare a nested closure,
typealias nestedDownload = (FirstItem: String!)-> (SencondItem: String!)->Void
Then I use this nestedDownload
closure as a parameter of the following function and try to complete the compliletion parameter value in function like as
func nestedDownloadCheck(compliletion:nestedDownload){
compliletion(FirstItem: "firstItem")
}
But this says the error, "Expression resolves to an unused function"
Also , when I call nestedDownloadCheck()
from ViewDidLoad()
method by tring to fill the body of the compilation
self.nestedDownloadCheck { (FirstString) -> (SecondString: String!) -> Void in
func OptionalFunction(var string:String)->Void{
}
return OptionalFunction("response")
}
This says the compilation error "Cannot convert return expression of type 'Void'(aka'()') to return Type '(SecondString: String!) -> Void' "
I can't find out how I exactly use the nested closure in this way .