Re: UIColor in CoreData database into NSColor
Re: UIColor in CoreData database into NSColor
- Subject: Re: UIColor in CoreData database into NSColor
- From: Alex Kac <email@hidden>
- Date: Fri, 20 Feb 2015 15:25:54 -0700
Since we’ll be changing future databases to store the data as our own “PIColor” that can be made into an NSColor/UIColor, the issue isn’t all that important for long/term/future - but simply backups made already from the last 5 years.
So if there is a way that we can get it working 9 times out of 10 - just to convert backups - then I’m OK with that.
> On Feb 20, 2015, at 2:48 PM, Quincey Morris <email@hidden> wrote:
>
> On Feb 20, 2015, at 11:15 , Alex Kac <email@hidden <mailto:email@hidden>> wrote:
>>
>> So with that in mind, has anyone tackled a conversion process of reading in UIColor data into NSColor via CoreData?
>
> I suspect that *really* solving this is going to be impossible.
>
> When you say “UIColor data”, do you mean the data resulting from archiving a UIColor object, or did you use something else to put it in the CoreData store? If it’s archived, you could try following the suggestion in the last response in this thread:
>
> http://stackoverflow.com/questions/3292836/create-uicolor-from-nscolor-data <http://stackoverflow.com/questions/3292836/create-uicolor-from-nscolor-data>
>
> That is to say, treat the raw data as a string, and then pick the components out of the string.
>
> The trouble you’re going to have is that a UIColor may not always be represented as components, since some standard colors may have an arbitrary enum—is representation. You also have to deal with possible alternate representations that might have been saved by the iOS app running on older versions of iOS. Even if you have components, you really need to match colorspaces as well.
>
> This makes me think you can get as far as getting NSColors that are at least similar to the UIColors, though sometimes they may not be exactly the same.
>
Alex Kac - President and Founder
Web Information Solutions, Inc.
"Forgiveness is not an occasional act: it is a permanent attitude."
-- Dr. Martin Luther King
_______________________________________________
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