<div>Yeah I am fairly sure that is by design. A lot of swifts access controls are about getting you up and going with little work / boilerplate while internal to your model while requiring you to be explicit about what you want to expose publicly outside of your module.</div><div><br class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg">On Wed, Jan 18, 2017 at 8:40 AM Adrian Zubarev via swift-users &lt;<a href="mailto:swift-users@swift.org" class="gmail_msg" target="_blank">swift-users@swift.org</a>&gt; wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg"><div class="m_-3878700698483847640m_-2827945217667759382bloop_markdown gmail_msg"><p class="gmail_msg">I feel like I’ve seen this discussion somewhere on the mailing list before. If I remember correctly or it could be only me, this behavior is by design, because you don’t want to open your API implicitly to everyone. Internally it won’t hurt your module, but only allow you to write less code and use the type right away.</p><br><br><br><br><p class="gmail_msg">It might be your intention of using this <code class="gmail_msg">init(firstName:lastName)</code> only internally, but disallow the module user from being able to construct that type manually. (The current behavior.)</p><br><br><br><br><p class="gmail_msg">Please feel free to correct me if I’m wrong here ;)</p><br><br><br><br><p class="gmail_msg"></p></div><div class="m_-3878700698483847640m_-2827945217667759382bloop_original_html gmail_msg"></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="m_-3878700698483847640m_-2827945217667759382bloop_original_html gmail_msg"><div id="m_-3878700698483847640m_-2827945217667759382bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto" class="gmail_msg"><br class="gmail_msg"></div> <br class="gmail_msg"> <div id="m_-3878700698483847640m_-2827945217667759382bloop_sign_1484757170073538048" class="m_-3878700698483847640m_-2827945217667759382bloop_sign gmail_msg"><div style="font-family:helvetica,arial;font-size:13px" class="gmail_msg">-- <br class="gmail_msg">Adrian Zubarev<br class="gmail_msg">Sent with Airmail</div></div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="m_-3878700698483847640m_-2827945217667759382bloop_original_html gmail_msg"> <br class="gmail_msg"><p class="m_-3878700698483847640m_-2827945217667759382airmail_on gmail_msg">Am 18. Januar 2017 um 16:33:22, Dave Reed via swift-users (<a href="mailto:swift-users@swift.org" class="gmail_msg" target="_blank">swift-users@swift.org</a>) schrieb:</p> <blockquote type="cite" class="m_-3878700698483847640m_-2827945217667759382clean_bq gmail_msg"><span class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"></div><div class="gmail_msg">I’m teaching an iOS with Swift this semester and one of my students pointed out that:<br class="gmail_msg"><br class="gmail_msg">struct Person {<br class="gmail_msg">   var firstName: String<br class="gmail_msg">   var lastName: String<br class="gmail_msg">}<br class="gmail_msg"><br class="gmail_msg">does create a default initializer that you can call as:<br class="gmail_msg">p = Person(firstName: “Dave”, lastName: “Reed”)<br class="gmail_msg"><br class="gmail_msg">but if you write:<br class="gmail_msg"><br class="gmail_msg">public struct Person {<br class="gmail_msg">   var firstName: String<br class="gmail_msg">   var lastName: String<br class="gmail_msg">}<br class="gmail_msg"><br class="gmail_msg">The default initializer is still internal so if you want it to be public, you have to write it yourself (i.e.)<br class="gmail_msg"><br class="gmail_msg">public struct Person {<br class="gmail_msg">   var firstName: String<br class="gmail_msg">   var lastName: String<br class="gmail_msg"><br class="gmail_msg">   public init(firstName: String, lastName: String) {<br class="gmail_msg">      self.firstName = firstName<br class="gmail_msg">      self.lastName = lastName<br class="gmail_msg">   }<br class="gmail_msg">}<br class="gmail_msg"><br class="gmail_msg">Is there a way around this (other than writing it)? We both agree it would be reasonable/nice that the default initializer have the same protection level as the struct itself.<br class="gmail_msg"><br class="gmail_msg">Thanks,<br class="gmail_msg">Dave Reed<br class="gmail_msg"><br class="gmail_msg">_______________________________________________<br class="gmail_msg">swift-users mailing list<br class="gmail_msg"><a href="mailto:swift-users@swift.org" class="gmail_msg" target="_blank">swift-users@swift.org</a><br class="gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-users" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a><br class="gmail_msg"></div></div></span></blockquote></div></div>_______________________________________________<br class="gmail_msg"><br><br>swift-users mailing list<br class="gmail_msg"><br><br><a href="mailto:swift-users@swift.org" class="gmail_msg" target="_blank">swift-users@swift.org</a><br class="gmail_msg"><br><br><a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a><br class="gmail_msg"><br><br></blockquote></div></div>