I have the following class, it was internal by default, but I’ve made it so 
explicitly for the purpose of the question. 

internal class ControllerBTLEListener: NSObject, CBCentralManagerDelegate
{
        // the queue for all our operations
        static let queue : dispatch_queue_t = dispatch_queue_create( "BTLE 
queue", DISPATCH_QUEUE_SERIAL )

        // implementation of CBCentralManagerDelegate
        func centralManagerDidUpdateState(central: CBCentralManager)
        {

        }
}


in this class, centralManagerDidUpdateState() is an internal function however 
the compiler is happy that the class satisfies CBCentralManagerDelegate even 
though that protocol is public and centralManagerDidUpdateState() is also 
public. How can this be, how can an internal function make a class conform to a 
public method on a public protocol. That function is required in the protocol. 

It gets stranger. If I change the class from internal to public the I’m 
required to mark centralManagerDidUpdateState() as public (it would be internal 
by default) to conform to the protocol so the compiler seems to know that 
function has to be public, but is allowing it to be internal if the class 
itself is internal. 

Compiler bug or more lack of understanding here? 
_______________________________________________

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