key-value-coding Questions
7
Solved
How can you get a string value from Swift 4 smart keypaths syntax (e.g., \Foo.bar)? At this point I'm curious about any way at all, does not matter if it's complicated.
I like the idea of type inf...
Desai asked 2/10, 2017 at 15:46
3
Solved
Recently I work with the function func setValue(_ value: AnyObject?, forKey key: String) of the NSKeyValueCoding protocol to change the text color of a UIPickerDate in the following way:
class Col...
Defy asked 17/6, 2015 at 15:11
6
Solved
What is the difference between objectForKey and valueForKey?
I looked both up in the documentation and they seemed the same to me.
Interknit asked 30/6, 2009 at 7:14
5
Solved
Is there any way to access an NSArray element with valueForKeyPath? Google's reverse geocoder service, for example, returns a very complex data structure. If I want to get the city, right now I hav...
Fellatio asked 22/9, 2009 at 16:24
5
Solved
I want to use valueForKeyPath on my NSDictionary, but the problem is that one of the keys is a string that starts with the @ symbol. I have no control over the naming of the key.
I'm having proble...
Homeward asked 14/10, 2009 at 17:39
4
Solved
I'd like to test whether an object has a writeable @property in the iPhone SDK.
One possible way of doing this is to check the -valueForKey: method, but that seems rather inelegant!
Example:
@...
Endgame asked 8/12, 2009 at 17:55
2
Solved
Why can't I observe the editing property of an instance of UITableViewController?
I'm using the following code:
[self addObserver:self
forKeyPath:@"editing"
options:(NSKeyValueObservi...
Typehigh asked 28/9, 2010 at 21:9
4
Solved
Is it possible to key-value code (KVC) with native Swift data structures such as Array and Dictionary? Key-Value coding is still available for NSFoundation structures within Swift, just like in Obj...
Coheman asked 14/10, 2014 at 17:59
2
Consider the following object:
struct User: Codable {
let id: Int
let email: String
let name: String
}
Is it posible to get a specific CodingKey for a given KeyPath?
let key = \User.name.cod...
Berchtesgaden asked 1/10, 2017 at 11:32
1
Objective-C has a setValue method which allows the developer to set a specific value to a field by it's name.
How can I do that in Swift without inheriting from NSObject and actually use the setVa...
Fishwife asked 21/9, 2015 at 12:20
4
Solved
When I filter an array of custom Swift classes using a Predicate I get the error:
*** NSForwarding: warning: object 0x78ed21a0 of class 'Plantivo1_6.Seed' does not implement methodSignatureForSe...
Avoid asked 25/6, 2015 at 11:56
5
Solved
I'm working on a little library that lets me do some basic key value coding with objects. Say I have the following object:
var data = { key1: "value1", key2: { nested1: 1, nested2: "wowza!" } };
...
Salzhauer asked 14/1, 2010 at 0:14
4
Solved
I have a class that looks like this:
@interface Properties : NSObject {
@private
NSNumber* prop1;
NSNumberBool* prop2;
//etc
where NSNumberBool is a typedef:
// in MyApp_Prefix.pch
typedef N...
Binky asked 16/10, 2009 at 7:9
1
Solved
My team has decided that new files should be written in swift, and I am seeing an odd problem with using KVC in an Objective-C object to set a property on a Swift object.
My Objective-C sets a pro...
Generalize asked 3/3, 2016 at 21:59
2
Solved
This question is really looking for a specific class that I know exists, but cannot find.
A few weeks ago I read through an article outlining a helper class for using KVC - it let you encapsulate ...
Seka asked 29/7, 2011 at 16:17
1
Solved
I have a custom UITableView subclass in which I override +accessInstanceVariablesDirectly to return NO in order to ensure attributes with no setter cannot be set using KVC.
When removing this tabl...
Chaplain asked 3/6, 2015 at 23:36
2
Solved
This example is contrived, but it shows my point.
So, if I have an object graph like the following:
{
sex = male;
uid = 637650940;
work = ({
employer = {
id = 116420715044499;
name = "Software...
Stevens asked 21/8, 2012 at 12:28
2
I'm successfully using the setValue(value, forKey: key) method in my NSKeyValueCoding compliant Swift NSObject subclass.
This works perfectly well on String optionals, e.g.
var name:String?
How...
Zootoxin asked 30/9, 2014 at 10:44
2
Solved
For example, I have an object that has three properties: firstName, middleName, lastName.
If I want to search a string "john" in all the properties using NSPredicate.
Instead of creating a predic...
Attorney asked 21/4, 2014 at 14:14
7
Solved
A class has a property (and instance var) of type NSMutableArray with synthesized accessors (via @property). If you observe this array using:
[myObj addObserver:self forKeyPath:@"theArray" options...
Antebellum asked 19/11, 2008 at 15:54
2
Solved
I have a json string
{"name":"test","bar":{"name":"testBar"}}
In objective c I have an object
@interface Foo : NSObject {
}
@property (nonatomic, retain) NSString * name;
@property (nonatomic, ...
Paddie asked 9/6, 2011 at 20:34
3
Solved
Is there a way to directly access an inner-array of an an outer array in Objective-C? For example, a call to an external data source returns the following object:
{
bio = "this is the profile.bio ...
Bloater asked 30/11, 2010 at 19:39
2
Solved
I'm using KVC to iterating through a few views. Having trouble setting BOOL properties:
[self setValue:YES forKeyPath:[NSString stringWithFormat:@"myView%d.userInteractionEnabled", n]];
I get: w...
Postfix asked 2/7, 2009 at 22:21
3
Solved
I was reading :Collection Accessor Patterns for To-Many Properties, but I'm not sure where can I or should I use this.
Can someone please point out some scenarios that I can use Collection Accessor...
Barramunda asked 30/6, 2013 at 5:47
1
Solved
I have an array which contains dictionary objects. In each dictionary the key are common. Now I want to get all the values of that key. I have got these values with iteration, but I am lookin...
Disini asked 22/2, 2013 at 6:15
1 Next >
© 2022 - 2024 — McMap. All rights reserved.