<div dir="ltr">The attribute wouldn&#39;t change the behavior. The reference is still implicitly unwrapped. IB Outlets are, at least currently, IUO by necessity. I think that this proposal looks to make it less redundant. I didn&#39;t fully spot the use of `let` on the first or second reading but there is another proposal being pitched for allowing computer properties to be `let`. This is similar in that regard. From the discussion there, it sounds like that part might not fit with the core team&#39;s vision for the optimizer? </div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 18, 2016 at 10:36 AM, Tony Allevato via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Similarly, a weak reference cannot be non-optional. I would be uncomfortable with an attribute changing that behavior. Having a non-optional field become nil or crash behind the scenes discards the safety of the Swift type system.<div><br></div><div>There are legitimate situations where a class might have unused outlets as well, where you would want an optional (`?`) type; for example, you could have an iPad nib that has additional views that aren&#39;t present in an iPhone nib, but both share the same view controller. In that case, you would want to have some of those outlets still be optional. (Your pitch may not prevent that behavior, but it&#39;s worth pointing out as a use case.)</div><div><br></div></div><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">On Wed, May 18, 2016 at 6:42 AM Vladimir.S via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Correct me if I&#39;m wrong, but `weak` reference can not be `let` just by<br>
definition: at some point in time such reference *can* become nil.<br>
<br>
On 18.05.2016 16:22, Daniel Steinberg via swift-evolution wrote:<br>
&gt; I would like to propose we modify the meaning of @IBOutlet in light of the accepted proposal SE-0054 Abolish ImplicitlyUnwrappedOptional type. I think this fits in with the current Swift 3 goals.<br>
&gt;<br>
&gt; Currently we use “var” and “!” when we declare an outlet like this:<br>
&gt;<br>
&gt; @IBOutlet weak var myLabel: UILabel!<br>
&gt;<br>
&gt; The “!” in the declaration allows us to use the outlet like this without unwrapping it<br>
&gt;<br>
&gt; myLabel.text = “Hello&quot;<br>
&gt;<br>
&gt; We use “var” and “UILabel!&quot; because myLabel starts its life out as nil and does not have a value until the connection is made. i.e. myLabel must be an optional if it accepts nil and the type is UILabel! instead of UILabel? so that we don’t have to unwrap it each time we use it.<br>
&gt;<br>
&gt; If we break the connection to the UILabel instance we crash at runtime for attempting to unwrap nil.<br>
&gt;<br>
&gt; Given this, I propose that we be able to write<br>
&gt;<br>
&gt; @IBOutlet weak let myLabel: UILabel<br>
&gt;<br>
&gt; In this case @IBOutlet has a meaning somewhat similar to lazy - it’s not that myLabel doesn’t exist until we first call it, but @IBOutlet indicates that myLabel should exist before we call it.<br>
&gt;<br>
&gt; If the connection isn’t made and myLabel doesn’t exist, we should crash as we do now. If the connection is not made in the nib or storyboard, this will crash at development time.<br>
&gt;<br>
&gt; This removes a case in which we use var - not because we want to change the value of a property but because of a detail in the tooling.<br>
&gt;<br>
&gt; This change also removes a case in which we use an Optional again for a detail in lifecycle and tooling.<br>
&gt;<br>
&gt; Best,<br>
&gt;<br>
&gt; Daniel<br>
&gt; _______________________________________________<br>
&gt; swift-evolution mailing list<br>
&gt; <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
&gt;<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>
</div></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>