Implementing dynamic member lookup on an enum with associated values leads to build errors when there is more than one keypath function. I have an en ...
Implementing dynamic member lookup on an enum with associated values leads to build errors when there is more than one keypath function. I have an en ...
Using a KMutableProperty1 to access a classes property works both as a getter and setter. To be able to access nested properties like I tried to ...
So I have a nested hash like below: To access the values at different levels, you could use multiple methods, like so: But maybe you need it in ...
I made a program to calculate the total width/height of views (sometimes I want the total width, sometimes I want the total height). The only catch is ...
I am building a custom renderer for JSON Forms in Swift to integrate with the JSON Forms architecture being used for our web-based apps. If you aren't ...
I have an object similar to: I am attempting to store a heterogeneous array of updates so I can use them later to set values. Something like this. ...
Is there a way in Swift 5 to iterate over all keypaths? I'm aware Mirror will give you string representations of the keys, but I can't use setValue as ...
I'm working on a class where a superclass and its subclasses have varying properties, but all of the same type that need identical processing before b ...
I am trying to add an observer to my AVPlayer in swift that allows reads when the video begins playing to control other functions on my player. When I ...
Works great. But the below code doesn't compile: Cannot convert value of type 'WritableKeyPath<(Int, Int), Int>' to expected argument ty ...
Suppose you want to keep track of one or more unique identifier(s). In this case, A has two properties that are considered unique to A, while B has on ...
I'm trying to use "Self.displayOrder" in a protocol extension, but it raises the following error "Thread 1: Fatal error: Could not extract a String fr ...
In Swift, you can define @dynamicMemberLookup (see documentation) to get direct access to properties that are nested inside another type. Is there a P ...
Consider the following snippet of code class A { var value: Int? } let a: A? = A() let kp = \A.value a?[keyPath: kp] = 10 print(a?.value) Th ...
I'm trying to get a keypath to the selected property of an IBOutlet within a class. But get: Type 'UIButton?' has no member 'isSelected' directly acc ...
I understand the basic idea of keyPaths but I do not understand its use cases. If you already know the type of the instance, you can access their prop ...
I got this code: I got generic classes and I need to create keypaths on a generic concrete type (like Person), but I am not sure how I can create k ...
I have two entities - Quote and Customer (one customer can have many quotes) Say I have a managed object called quote but I want to update the custom ...
how can I create a KeyPath from a nested class? I don't know how to access the nested class using Backslash. Example Code: Thanks in advance! ...
I have 2 types, A and B that implement the same methods and have the same properties on them. I have defined an extension to fetch a value in a sub pr ...