nsvaluetransformer

Cocoa: How to bind a boolean property to NSCellStateValue?

此生再无相见时 提交于 2019-12-10 14:38:59
问题 I would like to bind the boolean enabled property of an NSTextField to the state of an NSButton . I already tried adding a custom NSValueTransformer that transforms the state of the NSButton into NSNumber . However, in that scenario the text fields are disabled all the time for some reason. My second approach: To bad fails also since NSValueTransformer does not offer return primitives types such as BOOL . Example: The screenshot shows an example in which the text fields are disabled because

NSValueTranformer to encrypt data

拟墨画扇 提交于 2019-12-08 00:35:18
问题 I want to encrypt some core-data columns with help of an NSValueTransformer. The idea is, that I use data-type transformable and define some transformer for my datatypes. Inside the transformation-methods I want to encrypt/ decrypt the value. I defined a transformer that does actually nothing - the crypto-stuff is currently not implemented. @implementation StringCryptoTransformer + (Class)transformedValueClass { return [NSString class]; } + (BOOL)allowsReverseTransformation { return YES; } -

Cocoa Bindings - NSTableView - Swapping Values

你说的曾经没有我的故事 提交于 2019-12-06 16:30:19
Is an NSValueTransform subclass a good choice for displaying Core Data attributes into UI views displaying: A number string like (0,1,2,3,etc) into a string such as (Pending, Completed, Frozen, In progress, etc) A number string like (0,1) into a app-based image (red.png if 0, green.png if 1) Here's what Core Data displays for the two attributes, timer and status: Here is what I want to be displayed instead, without changing the values in Core Data: If not to use NSValueTransformer, in what other way is this possible? I do not want to see the data permanently converted, only for the benefit of

NSValueTranformer to encrypt data

陌路散爱 提交于 2019-12-06 06:10:38
I want to encrypt some core-data columns with help of an NSValueTransformer. The idea is, that I use data-type transformable and define some transformer for my datatypes. Inside the transformation-methods I want to encrypt/ decrypt the value. I defined a transformer that does actually nothing - the crypto-stuff is currently not implemented. @implementation StringCryptoTransformer + (Class)transformedValueClass { return [NSString class]; } + (BOOL)allowsReverseTransformation { return YES; } - (NSString*)transformedValue:(id)value { NSLog(@"Transformer: %@",value); if([value isKindOfClass:

iOS Core Data encryption using NSValueTransformer

这一生的挚爱 提交于 2019-12-04 14:02:04
I'm experimenting with encrypting data with Core Data and CommonCrypto. I am trying to use a NSValueTransformer to lazily encrypt and decrypt. However when I'm now trying save the encrypted data to the persistent store coordinator, it fails. Every time im trying to save my data to the database, it gives me: -[__NSCFString bytes]: unrecognized selector sent to instance I'm sure it's some sort of database and NSManagedObject mismatch, but I can't figure it out. I feel it's probably rather simple, but I can't find the solution. My code: NSValueTransformer class TryHardEncryption:

Custom NSValueTransformer in xcode 6 with swift

▼魔方 西西 提交于 2019-12-03 16:48:18
问题 Did anyone successfully implement a custom NSValueTransformer in xcode 6 beta with swift? I have the following swift class: import Foundation class myTransformer: NSValueTransformer { let amount = 100 override class func transformedValueClass() -> AnyClass! { return NSNumber.self } override func transformedValue(value: AnyObject!) -> AnyObject! { return value.integerValue + amount } } So all this transformer should do is, adding 100 to a given value in the gui. As you can see, the transformer

What can I do with an Transformable attribute type in Core Data on the iPhone?

十年热恋 提交于 2019-12-03 01:27:02
问题 There's this Transformable data type for attributes. What is it good for? Are there good examples? I'd like to play around with this. So after searching a while I came across this: NSValueTransformer. Seems to be something I need for this. So how would I get started with this? For example, if I wanted to store an UIColor object, would I make an transformer for that? What exactly is this thing transforming to or from? An NSData? And must the object which I pass to the transformer follow any

Where to implement NSValueTransformer for Core Data in Swift

≡放荡痞女 提交于 2019-12-02 16:35:11
问题 I'm trying to put entities in a Core Data store that each have non-standard data types - one is an NSDocument and the other is an NSURL. I get that within the .xcdatamodeld I need to declare them as Transformable. And I think I need to add something that implements NSValueTransformer to turn them into NSData (... or is there a default transformer that will do that automatically?) I think the question should be simple to answer: where do I implement it? I haven't found an explicit example of

What can I do with an Transformable attribute type in Core Data on the iPhone?

风流意气都作罢 提交于 2019-12-02 14:49:35
There's this Transformable data type for attributes. What is it good for? Are there good examples? I'd like to play around with this. So after searching a while I came across this: NSValueTransformer. Seems to be something I need for this. So how would I get started with this? For example, if I wanted to store an UIColor object, would I make an transformer for that? What exactly is this thing transforming to or from? An NSData? And must the object which I pass to the transformer follow any protocol? Brad Larson Transformable attributes are useful for storing nonstandard object types within

Where to implement NSValueTransformer for Core Data in Swift

别说谁变了你拦得住时间么 提交于 2019-12-02 07:44:36
I'm trying to put entities in a Core Data store that each have non-standard data types - one is an NSDocument and the other is an NSURL. I get that within the .xcdatamodeld I need to declare them as Transformable. And I think I need to add something that implements NSValueTransformer to turn them into NSData (... or is there a default transformer that will do that automatically?) I think the question should be simple to answer: where do I implement it? I haven't found an explicit example of doing this in Swift. There's an Objective-C example but the separation of .h and .m files makes it