Is it possible to get the KVC-String from Swift 4 KeyPath? -


for project working on, useful kvc-string keypath instance method receiving. short example:

struct person {     var name: string }  let propertycache = ["name": "something"]  func method<t>(_ keypath: keypath<person, t>) -> t? {     let kvcname = keypath.kvc     return propertycache[kvcname] } 

this might seem not useful, in project :) found property on keypath called _kvckeypathstring public, returns nil every time tried. or maybe possibility use reflection there? in advance ideas/solutions!

i don't know of pure swift way name of property string yet.

but, if add @objc attribute property _kvckeypathstring have value instead of being nil.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -