Seems entirely reasonable to me. POP aficionados may object, but I think the pros and cons of this type of access are well trodden terrain and I think it's a net win to have this available in Swift going forward.<br><div class="gmail_quote"><div dir="ltr">On Sat, May 28, 2016 at 18:53 Vanderlei Martinelli via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello.<div><br></div><div><br></div><div>This is the first draft. I'd like to know your opinion about it.</div><div><br></div><div>(I know that this subject could have been discussed before. If so, please indicate me the correct thread to follow and interact.)</div><div><br></div><div><br></div><div>Regards,</div><div><br></div><div>Vanderlei Martinelli</div><div><br></div><div><br></div><div>---</div><div><br></div><div><br></div><div><h2 style="margin:20px 0px 10px;padding:0px;font-size:24px;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(204,204,204);color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif">Introduction</h2><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">Protected access level will enable entities to be used within the container type and by derived types only.</p><h2 style="margin:20px 0px 10px;padding:0px;font-size:24px;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(204,204,204);color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif">Motivation</h2><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">Today Swift has three access levels (<code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">public</code>, <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">internal</code> and <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">private</code>), but lacks a way to describe a member that can be only visible to its type or derived types.</p><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">A common case is the <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">UIView</code> from UIKit. Many developers are tempted to make this call:</p><div style="color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px"><pre style="margin-top:0.5em;margin-bottom:0.5em;background-color:rgb(245,242,240);border:1px solid rgb(204,204,204);font-size:13px;line-height:1.5;overflow:auto;padding:1em 1em 1em 3.8em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;word-spacing:normal;word-wrap:normal"><code style="margin:0px;padding:0px;border:none;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-image:none;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;word-spacing:normal;word-wrap:normal;line-height:1.5">view<span style="color:rgb(153,153,153)">.</span><span style="color:rgb(221,74,104)">layoutSubviews</span><span style="color:rgb(153,153,153)">(</span><span style="color:rgb(153,153,153)">)</span><span style="width:3em;letter-spacing:-1px;border-right-width:1px;border-right-style:solid;border-right-color:rgb(153,153,153)"><span style="display:block"></span></span></code></pre></div><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">The documentation says: "You should not call this method directly. If you want to force a layout update, call the <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">setNeedsLayout</code>method instead to do so prior to the next drawing update. If you want to update the layout of your views immediately, call the <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">layoutIfNeeded</code> method."</p><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">But yes, you should call this method directly if you are subclassing the view and needs to perform additional layout to its subviews ("subclasses can override this method as needed"):</p><div style="color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px"><pre style="margin-top:0.5em;margin-bottom:0.5em;background-color:rgb(245,242,240);border:1px solid rgb(204,204,204);font-size:13px;line-height:1.5;overflow:auto;padding:1em 1em 1em 3.8em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;word-spacing:normal;word-wrap:normal"><code style="margin:0px;padding:0px;border:none;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-image:none;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;word-spacing:normal;word-wrap:normal;line-height:1.5"><span style="color:rgb(0,119,170)">public</span> <span style="color:rgb(0,119,170)">override</span> <span style="color:rgb(0,119,170)">func</span> <span style="color:rgb(221,74,104)">layoutSubviews</span><span style="color:rgb(153,153,153)">(</span><span style="color:rgb(153,153,153)">)</span> <span style="color:rgb(153,153,153)">{</span>
<span style="color:rgb(112,128,144)">// We are calling the super method directly here.</span>
<span style="color:rgb(0,119,170)">super</span><span style="color:rgb(153,153,153)">.</span><span style="color:rgb(221,74,104)">layoutSubviews</span><span style="color:rgb(153,153,153)">(</span><span style="color:rgb(153,153,153)">)</span>
<span style="color:rgb(112,128,144)">// Do more adjustments to this view's subviews...</span>
<span style="color:rgb(153,153,153)">}</span><span style="width:3em;letter-spacing:-1px;border-right-width:1px;border-right-style:solid;border-right-color:rgb(153,153,153)"><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span></span></code></pre></div><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">So, yes, we can call this method directly when subclassing, but the Swift compiler will not prevent you from do this when not subclassing or from any other foreign class. It will not even issue a warning.</p><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">In Objective-C problems like this are usually "solved" my adding a kind of "protected" header (<code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">.h</code>) that is intended to be included only when the developer is subclassing. In Swift we do not have headers, but we have the new access level model. So, if the declaration of this method was...</p><div style="color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px"><pre style="margin-top:0.5em;margin-bottom:0.5em;background-color:rgb(245,242,240);border:1px solid rgb(204,204,204);font-size:13px;line-height:1.5;overflow:auto;padding:1em 1em 1em 3.8em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;word-spacing:normal;word-wrap:normal"><code style="margin:0px;padding:0px;border:none;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-image:none;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;word-spacing:normal;word-wrap:normal;line-height:1.5">protected <span style="color:rgb(0,119,170)">func</span> <span style="color:rgb(221,74,104)">layoutSubviews</span><span style="color:rgb(153,153,153)">(</span><span style="color:rgb(153,153,153)">)</span><span style="width:3em;letter-spacing:-1px;border-right-width:1px;border-right-style:solid;border-right-color:rgb(153,153,153)"><span style="display:block"></span></span></code></pre></div><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">... no one outside the class or derived classes would be allowed to call this method directly.</p><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">Of course, there are other cases in the Cocoa frameworks and there are many other cases when we are developing software in Swift that the <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">protected</code> access level would be very usefull.</p><h2 style="margin:20px 0px 10px;padding:0px;font-size:24px;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(204,204,204);color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif">Proposed solution</h2><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">Create the <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">protected</code> access level.</p><h2 style="margin:20px 0px 10px;padding:0px;font-size:24px;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(204,204,204);color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif">Detailed design</h2><h3 style="margin:20px 0px 10px;padding:0px;font-size:18px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif">Reference Types (classes)</h3><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">When declarated by a <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">class</code> the protected member will be visible to the class itself and all the derived classes.</p><div style="color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px"><pre style="margin-top:0.5em;margin-bottom:0.5em;background-color:rgb(245,242,240);border:1px solid rgb(204,204,204);font-size:13px;line-height:1.5;overflow:auto;padding:1em 1em 1em 3.8em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;word-spacing:normal;word-wrap:normal"><code style="margin:0px;padding:0px;border:none;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-image:none;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;word-spacing:normal;word-wrap:normal;line-height:1.5"><span style="color:rgb(112,128,144)">// BaseClass.swift</span>
<span style="color:rgb(0,119,170)">public</span> <span style="color:rgb(0,119,170)">class</span> <span>BaseClass</span> <span style="color:rgb(153,153,153)">{</span>
<span style="color:rgb(0,119,170)">public</span> <span style="color:rgb(221,74,104)">protected</span><span style="color:rgb(153,153,153)">(</span><span style="color:rgb(0,119,170)">set</span><span style="color:rgb(153,153,153)">)</span> <span style="color:rgb(0,119,170)">var</span> x <span style="color:rgb(166,127,89);background-color:rgba(255,255,255,0.498039)">=</span> <span style="color:rgb(153,0,85)">20</span>
protected <span style="color:rgb(0,119,170)">let</span> y <span style="color:rgb(166,127,89);background-color:rgba(255,255,255,0.498039)">=</span> <span style="color:rgb(153,0,85)">10</span>
protected <span style="color:rgb(0,119,170)">func</span> <span style="color:rgb(221,74,104)">doSomething</span><span style="color:rgb(153,153,153)">(</span><span style="color:rgb(153,153,153)">)</span> <span style="color:rgb(153,153,153)">{</span>
<span style="color:rgb(112,128,144)">// ...</span>
<span style="color:rgb(153,153,153)">}</span>
<span style="color:rgb(153,153,153)">}</span>
<span style="color:rgb(112,128,144)">// DerivedClass.swift</span>
<span style="color:rgb(0,119,170)">public</span> <span style="color:rgb(0,119,170)">class</span> <span>DerivedClass</span><span style="color:rgb(153,153,153)">:</span> <span style="color:rgb(102,153,0)">BaseClass</span> <span style="color:rgb(153,153,153)">{</span>
protected <span style="color:rgb(0,119,170)">override</span> <span style="color:rgb(221,74,104)">doSomething</span><span style="color:rgb(153,153,153)">(</span><span style="color:rgb(153,153,153)">)</span> <span style="color:rgb(153,153,153)">{</span>
<span style="color:rgb(0,119,170)">self</span><span style="color:rgb(153,153,153)">.</span>x <span style="color:rgb(166,127,89);background-color:rgba(255,255,255,0.498039)">=</span> <span style="color:rgb(153,0,85)">10</span> <span style="color:rgb(166,127,89);background-color:rgba(255,255,255,0.498039)">*</span> <span style="color:rgb(0,119,170)">self</span><span style="color:rgb(153,153,153)">.</span>y
<span style="color:rgb(153,153,153)">}</span>
<span style="color:rgb(153,153,153)">}</span><span style="width:3em;letter-spacing:-1px;border-right-width:1px;border-right-style:solid;border-right-color:rgb(153,153,153)"><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span></span></code></pre></div><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">If the member is declared as <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">final</code> then it will be visible but not can be overrided by the derived classes. Just like it works with other access levels.</p><h3 style="margin:20px 0px 10px;padding:0px;font-size:18px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif">Value Types (structs, enums, etc.)</h3><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">Value types cannot have derived types. In this case the <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">protected</code> access level does not make sense and will not be allowed in their members.</p><h3 style="margin:20px 0px 10px;padding:0px;font-size:18px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif">Protocols</h3><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">Protocols do not declare access level for their members. So the <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">protected</code> access level is not applicable here.</p><h3 style="margin:20px 0px 10px;padding:0px;font-size:18px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif">Extensions</h3><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">Extensions will not be able do be protected nor their members.</p><h3 style="margin:20px 0px 10px;padding:0px;font-size:18px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif">Special Note</h3><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">The <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">protected</code> access level can only be applied to classes, structs and other types when nested inside other type. So the following code will not compile:</p><div style="color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px"><pre style="margin-top:0.5em;margin-bottom:0.5em;background-color:rgb(245,242,240);border:1px solid rgb(204,204,204);font-size:13px;line-height:1.5;overflow:auto;padding:1em 1em 1em 3.8em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;word-spacing:normal;word-wrap:normal"><code style="margin:0px;padding:0px;border:none;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-image:none;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;word-spacing:normal;word-wrap:normal;line-height:1.5"><span style="color:rgb(112,128,144)">// ERROR: A first level class cannot be protected.</span>
protected <span style="color:rgb(0,119,170)">class</span> <span>MyProtectedClass</span> <span style="color:rgb(153,153,153)">{</span>
<span style="color:rgb(112,128,144)">/// ...</span>
<span style="color:rgb(153,153,153)">}</span><span style="width:3em;letter-spacing:-1px;border-right-width:1px;border-right-style:solid;border-right-color:rgb(153,153,153)"><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span></span></code></pre></div><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">But nested declarations will be allowed, so this code will compile:</p><div style="color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px"><pre style="margin-top:0.5em;margin-bottom:0.5em;background-color:rgb(245,242,240);border:1px solid rgb(204,204,204);font-size:13px;line-height:1.5;overflow:auto;padding:1em 1em 1em 3.8em;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;word-spacing:normal;word-wrap:normal"><code style="margin:0px;padding:0px;border:none;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-image:none;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;word-spacing:normal;word-wrap:normal;line-height:1.5"><span style="color:rgb(112,128,144)">// We can declare a protected class (or struct, enum, etc.) if</span>
<span style="color:rgb(112,128,144)">// and only if they are nested inside other type.</span>
<span style="color:rgb(0,119,170)">public</span> <span style="color:rgb(0,119,170)">class</span> <span>MyPublicClass</span> <span style="color:rgb(153,153,153)">{</span>
protected <span style="color:rgb(0,119,170)">class</span> <span>MyProtectedClass</span> <span style="color:rgb(153,153,153)">{</span>
<span style="color:rgb(112,128,144)">/// ...</span>
<span style="color:rgb(153,153,153)">}</span>
<span style="color:rgb(153,153,153)">}</span>
<span style="color:rgb(112,128,144)">// Since `MyProtectedClass` is nested and protected we</span>
<span style="color:rgb(112,128,144)">// can have access to it here.</span>
<span style="color:rgb(0,119,170)">public</span> <span style="color:rgb(0,119,170)">class</span> <span>MyDerivedClass</span><span style="color:rgb(153,153,153)">:</span> <span style="color:rgb(102,153,0)">MyPublicClass</span> <span style="color:rgb(153,153,153)">{</span>
<span style="color:rgb(0,119,170)">public</span> <span style="color:rgb(0,119,170)">func</span> <span style="color:rgb(221,74,104)">doSomething</span><span style="color:rgb(153,153,153)">(</span><span style="color:rgb(153,153,153)">)</span> <span style="color:rgb(153,153,153)">{</span>
<span style="color:rgb(0,119,170)">let</span> c <span style="color:rgb(166,127,89);background-color:rgba(255,255,255,0.498039)">=</span> <span style="color:rgb(221,74,104)">MyProtectedClass</span><span style="color:rgb(153,153,153)">(</span><span style="color:rgb(153,153,153)">)</span>
<span style="color:rgb(112,128,144)">/// ...</span>
<span style="color:rgb(153,153,153)">}</span>
<span style="color:rgb(153,153,153)">}</span><span style="width:3em;letter-spacing:-1px;border-right-width:1px;border-right-style:solid;border-right-color:rgb(153,153,153)"><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span><span style="display:block"></span></span></code></pre></div><h2 style="margin:20px 0px 10px;padding:0px;font-size:24px;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(204,204,204);color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif">Impact on existing code</h2><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">The imported Cocoa frameworks may have annotations on the "Objective-C side" that will inform if one member is <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">protected</code>. If this will be case (for the <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">layoutSubviews</code> method, as example), only code accessing these now protected members outside the owner class and its derived classes will have to change (currently this can be considered an error, anyway).</p><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">Any other code will be not impacted by this feature as it is new to the language.</p><h2 style="margin:20px 0px 10px;padding:0px;font-size:24px;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(204,204,204);color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif">Alternatives considered</h2><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">Do not add the <code style="margin:0px 2px;padding:0px 5px;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">protected</code> access level to the current model.</p><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px"><br></p><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px">---</p><p style="margin:15px 0px;color:rgb(0,0,0);font-family:Helvetica,arial,sans-serif;font-size:14px"><br></p></div><div><br></div><div><br></div></div>
_______________________________________________<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>