• 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: KVC and Core Foundation types
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KVC and Core Foundation types


  • Subject: Re: KVC and Core Foundation types
  • From: Charles Srstka <email@hidden>
  • Date: Thu, 31 Jan 2013 23:58:44 -0600

On Jan 31, 2013, at 11:46 PM, Quincey Morris <email@hidden> wrote:

> On Jan 31, 2013, at 21:08 , Kyle Sluder <email@hidden> wrote:
>
>> But CFTypes *are* NSObjects.
>
> Only if they're toll-free bridged

Huh? It's been my understanding that all CFTypes bridge to NSObjects. CGPathRef certainly does:

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        CGPathRef path = CGPathCreateWithRect(CGRectMake(0, 1, 2, 3), NULL);

        for (Class class = [(__bridge id)path class]; class != nil; class = [class superclass]) {
            NSLog(@"%@", NSStringFromClass(class));
        }

        CGPathRelease(path);
    }
    return 0;
}

2013-01-31 23:55:51.570 typetest[2906:303] __NSCFType
2013-01-31 23:55:51.576 typetest[2906:303] NSObject

Given this, I'd expect you could make it work with KVC by making the property an id instead of a CGPathRef, and doing a bridge cast every time you want to use it. Of course, overriding valueForKey: is probably cleaner though.

Charles


_______________________________________________

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: 
 >KVC and Core Foundation types (From: Graham Cox <email@hidden>)
 >Re: KVC and Core Foundation types (From: Seth Willits <email@hidden>)
 >Re: KVC and Core Foundation types (From: Kyle Sluder <email@hidden>)
 >Re: KVC and Core Foundation types (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: KVC and Core Foundation types
  • Next by Date: Re: KVC and Core Foundation types
  • Previous by thread: Re: KVC and Core Foundation types
  • Next by thread: Re: KVC and Core Foundation types
  • Index(es):
    • Date
    • Thread