• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Swift - internal class conforming to public protocol
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Swift - internal class conforming to public protocol


  • Subject: Re: Swift - internal class conforming to public protocol
  • From: Andreas Mayer <email@hidden>
  • Date: Wed, 25 Nov 2015 08:56:32 +0100

> Am 25.11.2015 um 08:13 schrieb Marco S Hyman <email@hidden>:
>
> As I read that adopting a public protocol requires the methods that implement the protocol to be public (but only those methods).

That's not how I read it. And it does not to work that way either. This compiles fine:

public protocol PublicProtocol {
	func someFunction()
}

internal class SomeClass: PublicProtocol {
	internal func someFunction() {
		// implementation
	}
}

I think it means you can't declare internal functions for a public protocol, whereas you can declare internal functions for a public class.

This does not compile:

public protocol OtherPublicProtocol {
	internal func someFunction()
}

The compiler complains that "'internal' modifier cannot be used in protocols".


Andreas
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


References: 
 >Swift - internal class conforming to public protocol (From: Roland King <email@hidden>)
 >Re: Swift - internal class conforming to public protocol (From: Andreas Mayer <email@hidden>)
 >Re: Swift - internal class conforming to public protocol (From: Roland King <email@hidden>)
 >Re: Swift - internal class conforming to public protocol (From: Andreas Mayer <email@hidden>)
 >Re: Swift - internal class conforming to public protocol (From: Marco S Hyman <email@hidden>)

  • Prev by Date: Re: Swift - internal class conforming to public protocol
  • Next by Date: Re: Swift - internal class conforming to public protocol
  • Previous by thread: Re: Swift - internal class conforming to public protocol
  • Next by thread: Re: Swift - internal class conforming to public protocol
  • Index(es):
    • Date
    • Thread