[swift-users] Closure "shadowing" functions.

Tino Heth 2th at gmx.de
Fri Jan 8 06:37:21 CST 2016


iClass.myProperty(iClass())("func")

But I would rather avoid shadowing at all.

> Am 08.01.2016 um 13:24 schrieb Wallacy via swift-users <swift-users at swift.org>:
> 
> 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/03eef523/attachment.html>


More information about the swift-users mailing list