[swift-evolution] let type binding
James Campbell
james at supmenow.com
Thu Dec 17 05:59:05 CST 2015
Currently swift lets you to bind a value to let once:
i.e
let value: UIViewController
if (condition)
{
value = controllerA
}
else
{
value = controllerB
}
But currently I have to cast the variable within these blocks to access the
property. It would be great if Swift could treat the let value as being the
type of the object I am setting just for this closure/block (Obviously we
can only set it to a value that matches the type above.)
So I could literally go like this:
let value: UIViewController
if (condition)
{
value = controllerA
value.controllerAProperty = []
}
else
{
value = controllerB
value.controllerBProperty = []
}
--
Wizard
james at supmenow.com
+44 7523 279 698
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151217/95e2febb/attachment.html>
More information about the swift-evolution
mailing list