[swift-users] Closure "shadowing" functions.

Wallacy wallacyf at gmail.com
Fri Jan 8 06:24:52 CST 2016


class iClass{
    let myProperty:(String)->() = { value in
        print("1: \(value)");
    }
    func myProperty(value: String)->() {
        print("2: \(value)");
    }
}

iClass().myProperty("a"); // 1: a

No error is thrown in this case, however it is not possible to call the
"myProperty (value: String) -> ()" function, is there any alternative? This
is expected behavior?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160108/d4a461e3/attachment.html>


More information about the swift-users mailing list