<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif">I am a little odd about it too.</div><div class="gmail_default" style="font-family:georgia,serif"><br></div><div class="gmail_default" style="font-family:georgia,serif">However, if you give it a try, you will get the results.</div><div class="gmail_default" style="font-family:georgia,serif"><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_default" style="font-family:georgia,serif"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="color:rgb(187,44,162)">var</span><span> lazyStruct = </span><span style="color:rgb(79,129,135)">lazyTest</span><span>(lazyVariable: </span><span style="color:rgb(39,42,216)">5</span><span>, someProperty: </span><span style="color:rgb(39,42,216)">6</span><span>)</span></p></div><div class="gmail_default" style="font-family:georgia,serif"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(79,129,135)"><span>lazyStruct</span><span style="color:rgb(0,0,0)">.</span><span>lazyVariable</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,132,0)">// 5</span></p></div><div class="gmail_default" style="font-family:georgia,serif"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><br></p></div><div class="gmail_default" style="font-family:georgia,serif"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="color:rgb(187,44,162)">var</span><span> anotherStruct = </span><span style="color:rgb(79,129,135)">lazyTest</span><span>(lazyVariable:</span><span style="color:rgb(187,44,162)">nil</span><span>, someProperty: </span><span style="color:rgb(39,42,216)">7</span><span>)</span></p></div><div class="gmail_default" style="font-family:georgia,serif"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(79,129,135)"><span>anotherStruct</span><span style="color:rgb(0,0,0)">.</span><span>lazyVariable</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,132,0)">// 10</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(79,129,135)"><span style="color:rgb(0,132,0)"><br></span></p></div></blockquote><div class="gmail_default" style="display:inline"><font face="georgia, serif" color="#000000">Everything works fine. If you give it a value, it just ignores the lazy part. If you give it a nil, it works as you expect.</font></div><div><div class="gmail_default" style="display:inline"><font face="georgia, serif" color="#000000"><br></font></div></div><div><div class="gmail_default" style="display:inline"><font face="georgia, serif" color="#000000">So initializer of Struct just adopts to a more flexible way, I think. </font></div></div><div><div class="gmail_default" style="display:inline"><font face="georgia, serif" color="#000000"><br></font></div></div><div><div class="gmail_default" style="display:inline"><font face="georgia, serif" color="#000000">Zhaoxin</font></div><div><font color="#000000" face="georgia, serif"><br></font></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 27, 2016 at 5:15 PM, Pritesh Nandgaonkar via swift-users <span dir="ltr"><<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I have a struct with two properties one being Lazy and other being the normal one.When I try to initialise the struct the init function autosuggests the lazy property to be optional.Ideally the implementation should be such that, only non lazy and non computed properties must have been passed to the initialiser.Obviously this could be done through custom init implementation.But would like to know why its not handled.</div><div><br></div><div>Have a look at the image for reference.</div><div><br></div><div><img src="cid:ii_154f17eeea02f831" alt="Inline image 2" width="412" height="116"><span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888">-- <br><div data-smartmail="gmail_signature"><div dir="ltr">Pritesh Nandgaonkar<div>Department of Electrical Engineering</div><div>IIT Bomba</div></div></div>
</font></span></div>
<br>_______________________________________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a><br>
<br></blockquote></div><br></div>