Re: [swift-users] default struct initializer internal even if class declared public

2017-01-18 Thread Adrian Zubarev via swift-users
PS: If we’re talking about iOS here than public and open makes less sense as long as you’re not writing a framework for iOS. Each type that is considered to be used in other projects can be seen as an own module, only then access modifiers like public or open makes some sense again. ;) -- 

Re: [swift-users] default struct initializer internal even if class declared public

2017-01-18 Thread Shawn Erickson via swift-users
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. On Wed, Jan 18, 2017 at 8:40 AM

Re: [swift-users] default struct initializer internal even if class declared public

2017-01-18 Thread Adrian Zubarev via swift-users
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

Re: [swift-users] default struct initializer internal even if class declared public

2017-01-18 Thread Kevin Nattinger via swift-users
I ran into this issue not half an hour ago; I would also prefer the default initializer to default to the entity’s access level, or at least have some simple way of opting in. > On Jan 18, 2017, at 3:33 PM, Dave Reed via swift-users > wrote: > > I’m teaching an iOS

[swift-users] default struct initializer internal even if class declared public

2017-01-18 Thread Dave Reed via swift-users
I’m teaching an iOS with Swift this semester and one of my students pointed out that: struct Person { var firstName: String var lastName: String } does create a default initializer that you can call as: p = Person(firstName: “Dave”, lastName: “Reed”) but if you write: public struct