> On Aug 18, 2015, at 12:20 PM, Jens Alfke <j...@mooseyard.com> wrote:
> 
> But would Swift have caught this issue, since the CALayer.context property 
> isn’t visible in headers at all, only in the compiled code?

Jens Alfke, of mooseyard.com <http://mooseyard.com/>, has presented us with a 
poser. We do not know which bush the private method is behind. But we can soon 
find out.

MyBaseClass.h in framework:

#import <Foundation/Foundation.h>

@interface MyBaseClass : NSObject

- (void)foo;

@end

MyBaseClass.m in framework:

#import "MyBaseClass.h"

@implementation MyBaseClass

- (void)foo {
    fprintf(stderr, “BOOM!\n");
}

@end

App:

import MyFramework

class MyClass: MyBaseClass {
    func bar() {
        print(“BLEAH!")
    }
}

let obj = MyClass()

obj.foo()

Output:

BOOM!

New MyBaseClass.m:

#import "MyBaseClass.h"

@implementation MyBaseClass

- (void)foo {
    fprintf(stderr, "BOOM!\n");
    
    [self bar];
}

- (void)bar {
    fprintf(stderr, "Bar called in framework\n");
}

@end

Output without recompiling the app:

BOOM!
BLEAH!

Output after recompiling the app:

No compiler errors, then:

BOOM!
BLEAH!

Yes, it was the middle one. (And also the one on the right.)

Charles

_______________________________________________

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