> On 11 May 2016, at 13:49, Vladimir.S via swift-evolution
> <[email protected]> wrote:
>
> public var a = 10 // OK, all is clear here
> public var a = "sdfsdf" // OK
> public var a = someFunction() // not OK - add type of `a` explicitly
I’m not clear on why you think the third one isn’t okay; Xcode can tell you
what the type was inferred to be, you can check the function signature (alt -
click the name) which will tell the type that it returns, as well as call up
any documentation about what it does.
The only reason you would need to set a type on the property is if you know
you’ll need to assign something less specific in future, e.g- a parent type in
a class hierarchy.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution