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

Charles Srstka cocoadev at charlessoft.com
Tue Jul 25 11:31:14 CDT 2017


> 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))”

Charles



More information about the swift-users mailing list