The rules are laid out in SE-0025. What you are finding is that SE-0025 is not yet fully implemented.<br><div class="gmail_quote"><div dir="ltr">On Sat, Apr 15, 2017 at 11:04 Tino Heth &lt;<a href="mailto:2th@gmx.de">2th@gmx.de</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><blockquote type="cite"><div>Am 15.04.2017 um 17:33 schrieb Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt;:</div><br class="m_3848811173021902684Apple-interchange-newline"><div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_quote"><div>I think you misunderstand how access modifiers currently work with extensions. It is not permitted to use an access modifier inside an extension that is higher than that of the extension itself.</div></div></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div><div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures;color:#ba2da2">class</span><span style="font-variant-ligatures:no-common-ligatures"> Check {}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(186,45,162)"><span style="font-variant-ligatures:no-common-ligatures">fileprivate</span><span style="font-variant-ligatures:no-common-ligatures;color:#000000"> </span><span style="font-variant-ligatures:no-common-ligatures">extension</span><span style="font-variant-ligatures:no-common-ligatures;color:#000000"> </span><span style="font-variant-ligatures:no-common-ligatures;color:#4f8187">Check</span><span style="font-variant-ligatures:no-common-ligatures;color:#000000"> {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(186,45,162)"><span style="font-variant-ligatures:no-common-ligatures;color:#000000"><span class="m_3848811173021902684Apple-tab-span" style="white-space:pre-wrap">        </span></span><span style="font-variant-ligatures:no-common-ligatures">public</span><span style="font-variant-ligatures:no-common-ligatures;color:#000000"> </span><span style="font-variant-ligatures:no-common-ligatures">func</span><span style="font-variant-ligatures:no-common-ligatures;color:#000000"> px() {</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(209,47,27)"><span style="font-variant-ligatures:no-common-ligatures;color:#000000"><span class="m_3848811173021902684Apple-tab-span" style="white-space:pre-wrap">                </span></span><span style="font-variant-ligatures:no-common-ligatures;color:#3e1e81">print</span><span style="font-variant-ligatures:no-common-ligatures;color:#000000">(</span><span style="font-variant-ligatures:no-common-ligatures">&quot;It compiles!&quot;</span><span style="font-variant-ligatures:no-common-ligatures;color:#000000">)</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span class="m_3848811173021902684Apple-tab-span" style="white-space:pre-wrap">        </span>}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">}</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(79,129,135)"><span style="font-variant-ligatures:no-common-ligatures">Check</span><span style="font-variant-ligatures:no-common-ligatures;color:#000000">().</span><span style="font-variant-ligatures:no-common-ligatures;color:#31595d">px</span><span style="font-variant-ligatures:no-common-ligatures;color:#000000">()</span></div></div><div><br></div><div>This code executes without complains — but your example is right, it fails if the extension is marked private… wtf? Access modifiers aren&#39;t even mentioned in <a href="https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Extensions.html#//apple_ref/doc/uid/TP40014097-CH24-ID151" target="_blank">https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Extensions.html#//apple_ref/doc/uid/TP40014097-CH24-ID151</a></div><div><br></div><div>It really seems to me that the current extension-model is somewhat broken; do you have a link to documentation of access levels for extensions?</div></div></div><div style="word-wrap:break-word"><div><br><blockquote type="cite"><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_quote"><div>```</div><div>private struct S {</div><div>  private extension {</div><div>    func f() { } // what is the access level of `f`?</div><div>  }</div><div>}</div><div>```</div></div></div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">If `f` is private, then it is invisible outside the extension. But `f` cannot be `fileprivate`, because `fileprivate` is more visible than the private extension and is therefore not allowed.</div></blockquote></div></div><div style="word-wrap:break-word"><div></div><div>I&#39;d simply say f is private and only visible inside the extension…</div><br></div></blockquote></div>