[swift-users] How to cast within #keyPath() ?

Manfred Schubert dev at schubert-it.com
Tue Jul 25 11:42:56 CDT 2017


> Am 25.07.2017 um 18:31 schrieb Charles Srstka <cocoadev at charlessoft.com>:
> 
>> On Jul 25, 2017, at 11:26 AM, Manfred Schubert <dev at schubert-it.com> wrote:
>> 
>> 
>>> Am 25.07.2017 um 18:21 schrieb Charles Srstka <cocoadev at charlessoft.com>:
>>> 
>>> #keyPath(MyView.property) should do it, I’d think.
>> 
>> I think it wouldn't. It returns "property", but the path needs to be "view.property”.
> 
> Ah, you’re right. This should work, though:
> 
> “\(#keyPath(view)).\(#keyPath(MyView.property))”

Yes, that should work. Thank you, Charles!


Manfred



More information about the swift-users mailing list