Questions tagged [nskeyvaluecoding]

5 questions
26
votes
2 answers

Using setValue(value, forKey: key) on Int? types fires non key value coding-compliant method

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? However, on Int optionals, it fails, triggering the…
Max MacLeod
  • 26,115
  • 13
  • 104
  • 132
3
votes
2 answers

I'm using KeyValueObjectMapping developed by dchohfi. But facing issue in mapping JSON object array

JSON Model Library I have a Json object & respective models - { "type": "flight", "senderid": "101", "message": { "origin": "Bangalore", "destination": "Paris", "start_date": "21-04-2017", "end_date": "27-04-2017", "price":…
0
votes
2 answers

NSKeyValueCoding.setValue(_:forKey:) not working in SwiftUI

I am unable to produce a proper minimal working example, mainly due to my novice level understanding of iOS development, but I do have a simple SwiftUI project that may help. In my ContentView.swift: import SwiftUI struct ContentView: View { …
Ben Jasperson
  • 300
  • 4
  • 17
0
votes
2 answers

Calling setValuesForKeys fails in my Swift 4 code

I'm having this problem, im trying to retrieve data from the firebase database, but it's saying the profilepic isn't a key, but it is. This is the object class. class User: NSObject { var firstname: String? var lastname: String? var…
0
votes
1 answer

NSKeyValueObserving not working

I wrote a CLLocationManager Singleton called LocationManager and want to observe updated location. But the observing part is not working. Can anyone tell me what the problem is. Thanks. The following are my…
Jennifer He
  • 75
  • 1
  • 2
  • 10