>> if I define an internal class which implements a public protocol, who is 
>> able to call the methods in that protocol? Anyone (it’s a public protocol), 
>> only classes in the same framework or source file (the class is internal)?
> 
> If you declare it internal it's internal. Adopting a public protocol doesn't 
> change that.

There is a specific note in the Swift book:

“If you define a public protocol, the protocol’s requirements require a public 
access level for those requirements when they are implemented. This behavior is 
different from other types, where a public type definition implies an access 
level of internal for the type’s members.”

Excerpt From: Apple Inc. “The Swift Programming Language (Swift 2.1 
Prerelease).” iBooks. 

As I read that adopting a public protocol requires the methods that implement 
the protocol to be public (but only those methods).
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to