Getting string from Swift 4 new key path syntax?

前端 未结 4 2121
别那么骄傲
别那么骄傲 2021-02-01 14:33

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

4条回答
  •  自闭症患者
    2021-02-01 15:08

    A bit late to the party, but I've stumbled upon a way of getting a key path string from NSObject subclasses at least:

    NSExpression(forKeyPath: \UIView.bounds).keyPath
    

提交回复
热议问题