Here's a little test function:
import UIKit
func foo() {
let views1 = (1...2).map { _ in
let v = UIView()
return v
}
let views2 = (1...2).map { _ in
return UIView()
}
}
I would expect the two map calls to behave identically. In fact, view2 compiles fine; but I get this error on view1:
error: cannot invoke 'map' with an argument list of type '(@noescape (Int) throws -> _)'
let views1 = (1...2).map { _ in
^
note: expected an argument list of type '(@noescape (Self.Generator.Element) throws -> T)'
let views1 = (1...2).map { _ in
^
Can anyone tell me what is going on?
Thanks.