Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
0 votes
1 answer
87 views

Context Consider this class and the KeyPath instances: class Foo { var name: String? = "" } var foo = Foo() let keyPath: ReferenceWritableKeyPath<Foo, String?> = \.name let ...
2 votes
1 answer
538 views

I've been stuck on this for the past week and I'm asking here out of desperation. I have a project using Swift 5, and I recently enabled "Strict Concurrency Checking" to "Complete" so I can slowly ...
0 votes
0 answers
38 views

From what I understand, it should be ok to send a Keypath over actor boundaries if what it points to is Sendable, and it feels like this should be the case in this snippet? If not, can someone explain ...
0 votes
1 answer
181 views

Context I'm attempting to create a Swift Predicate using the #Predicate macro as shown here: final class Foo { var title: String = "" var name: String = "" } let p = #...
1 vote
1 answer
339 views

I am new to the Swift and the SwiftUI. Trying to understand how sorting works on SwiftUI Table view. The following code does what I intend to do, but I am not able to understand how does it actually ...
1 vote
1 answer
245 views

To begin with I have this code, which works totally fine: protocol ComponentAccessible {} extension ComponentAccessible { func components<each T>(_ keyPaths: repeat KeyPath<Self, each T&...
1 vote
1 answer
73 views

As example I have struct/class: struct Pet { var id: String var name: String var age: Int var type: PetType } enum PetType: Int { case cat case dog } Is it possible to write ...
Andrew's user avatar
  • 12k
0 votes
1 answer
384 views

This is a simplified version of my code but I'd like to be able to initialise an NSPredicate from a generic KeyPath<Root, Value> but despite persistent attempts I've fallen short. Can anyone ...
0 votes
1 answer
98 views

I'm trying to build a new SwiftUI View that encapsulates a Toggle. The Toggle accesses a collection so that it can show up in a mixed state. I'm having difficulties constructing the proper KeyPath. I'...
-1 votes
1 answer
243 views

SwiftUI modifiers don't allow passing optional values, and I'd really like to handle them in a clean way. E.g. struct MyView: View { let accessibilityValue: String? var body: some View { ...
3 votes
1 answer
867 views

I can successfully load a custom ShaderGraphMaterial material loaded from a .usda file created with Reality Composer var shotTrailMaterial : ShaderGraphMaterial? = nil do { ... let materialData =...
15 votes
1 answer
1k views

I have the following models: @Model class Game { var name: String var firstReleasedOn: Date? @Relationship(deleteRule: .cascade, inverse: \QueueEntry.game) var queueEntry: QueueEntry? ...
1 vote
0 answers
148 views

I have a Product class inherited from Realm Object: @objc class Product: Object { @Persisted(primaryKey: true) var id: String = "" @Persisted var externalId: String? @Persisted ...
0 votes
0 answers
32 views

I need to put KeyPath values in an array of type Array<KeyPath<CNContact,Any>>. However, \CNContact.phoneNumbers fails to cast to KeyPath<CNContact,Any>. Here is my test code: let ...
0 votes
0 answers
87 views

Context: I saved a list of objects in realm repository. These objects contain a property of standard type Date. I would like to get a list of those objects back from Realm based on distinct dates ...

15 30 50 per page
1
2 3 4

AltStyle によって変換されたページ (->オリジナル) /