Currently KVO requires hard-coding strings to check the keypath. Does
SE-0064 cover returning a string when a string is required? For example:
override func observeValueForKeyPath(keyPath: String?,
ofObject object: AnyObject?,
change: [String : AnyObject]?,
context: UnsafeMutablePointer<Void>) {
if let changingThing = object as? Thing,
keyPath = keyPath where changingThing === thing {
switch keyPath {
case "thingWatched": ...
I'd like to replace that last line with:
case #selector(Thing.thingWatched):
Or something similarly non-stringy.
Alternately, this comes back to your "Referencing Objective-C key-paths"
proposal, but I'm wondering if 0064 already covers this case.
-Rob
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution