Post

Replies

Boosts

Views

Activity

Get CloudKit records created by specific user
I've been searching all over the web trying to find the proper way to get all records created by a specific user in CloudKit. I am able to get the correct id using: guard let userRecordID = try? await container.userRecordID() else { return } I can see that the id returned is associated with records in my CloudKit dashboard. So I would expect that the following would get those records: let predicate = NSPredicate(format: "%K == %@", #keyPath(CKRecord.creatorUserRecordID), userRecordID) let query = CKQuery(recordType: "CKUser", predicate: predicate) But instead when I use that query it returns nothing. It is successful but with nothing returned... Any ideas why this would be happening? P.S. I have also tried constructing the predicate using the reference, but I get the same result - success with no results. P.S.2 Also worth mentioning that I am trying to get the results from the public database and I have set my CKContainer to the correct container id.
5
0
988
Dec ’24
SwiftUI and MapKit - Find address from coordinates
I've seen a lot of posts around the internet about getting coordinates from an address, but none about how to do the opposite. What I would like to do is allow a person to drop a pin and then programmatically look up the address closest to the pin. Like if I drop a pin inside a mall on the map I would like to capture the address to the mall. Does anyone know how this could be done?
2
0
1.3k
Aug ’24
SwiftUI - Using the Drag and Magnification Gestures Sequenced
Hello, I have a view in SwiftUI that has both a Drag and Magnification Gesture. Before iOS 15 my app worked with both gestures on the same view. This is how they are composed: let dragGesture = DragGesture()             .onChanged { value in                 //self.offset = value.translation                 self.currentPosition = CGSize(width: value.translation.width + self.newPosition.width, height: value.translation.height + self.newPosition.height)         }         .onEnded { value in             withAnimation {                 self.currentPosition = CGSize(width: value.translation.width + self.newPosition.width, height: value.translation.height + self.newPosition.height)                 self.newPosition = self.currentPosition                 self.isDragging = false             }         }         let pressGesture = LongPressGesture()             .onEnded { value in                 withAnimation {                     self.isDragging = true                 }         }         let pressGestureDelete = LongPressGesture(minimumDuration: 3)             .onEnded { value in                 self.deleteBtn = true         }         let resizeGesture = MagnificationGesture(minimumScaleDelta: 0.1)             .onChanged { value in                 self.scale *= value             }         .onEnded { value in             self.scale *= value         }                  let combined = pressGesture.sequenced(before: dragGesture).simultaneously(with: pressGestureDelete).simultaneously(with: resizeGesture) And then on my view I am adding the gesture as .gesture(combined) Since iOS 15 this no longer works. Instead I can drag the view around after the long press, but as soon as I attempt a resize using the magnification gesture the whole app freezes. I have tried attaching the magnification gesture to different pieces of the view thinking that maybe it needs to be at a different level (parent/child) from the drag gesture, but I get the same behavior if there is a drag gesture and a magnification gesture in the same view. It doesn't seem to matter how I attach them, if they both exist in the same view it causes the whole app to become unresponsive. Does anyone know how to overcome this? Is this the new "intended" functionality? If so what do we do for the users who are accustomed to being able to seamlessly drag something and then resize it? Thank you in advance.
5
1
5.0k
Mar ’22
Get CloudKit records created by specific user
I've been searching all over the web trying to find the proper way to get all records created by a specific user in CloudKit. I am able to get the correct id using: guard let userRecordID = try? await container.userRecordID() else { return } I can see that the id returned is associated with records in my CloudKit dashboard. So I would expect that the following would get those records: let predicate = NSPredicate(format: "%K == %@", #keyPath(CKRecord.creatorUserRecordID), userRecordID) let query = CKQuery(recordType: "CKUser", predicate: predicate) But instead when I use that query it returns nothing. It is successful but with nothing returned... Any ideas why this would be happening? P.S. I have also tried constructing the predicate using the reference, but I get the same result - success with no results. P.S.2 Also worth mentioning that I am trying to get the results from the public database and I have set my CKContainer to the correct container id.
Replies
5
Boosts
0
Views
988
Activity
Dec ’24
SwiftUI and MapKit - Find address from coordinates
I've seen a lot of posts around the internet about getting coordinates from an address, but none about how to do the opposite. What I would like to do is allow a person to drop a pin and then programmatically look up the address closest to the pin. Like if I drop a pin inside a mall on the map I would like to capture the address to the mall. Does anyone know how this could be done?
Replies
2
Boosts
0
Views
1.3k
Activity
Aug ’24
SwiftUI - Using the Drag and Magnification Gestures Sequenced
Hello, I have a view in SwiftUI that has both a Drag and Magnification Gesture. Before iOS 15 my app worked with both gestures on the same view. This is how they are composed: let dragGesture = DragGesture()             .onChanged { value in                 //self.offset = value.translation                 self.currentPosition = CGSize(width: value.translation.width + self.newPosition.width, height: value.translation.height + self.newPosition.height)         }         .onEnded { value in             withAnimation {                 self.currentPosition = CGSize(width: value.translation.width + self.newPosition.width, height: value.translation.height + self.newPosition.height)                 self.newPosition = self.currentPosition                 self.isDragging = false             }         }         let pressGesture = LongPressGesture()             .onEnded { value in                 withAnimation {                     self.isDragging = true                 }         }         let pressGestureDelete = LongPressGesture(minimumDuration: 3)             .onEnded { value in                 self.deleteBtn = true         }         let resizeGesture = MagnificationGesture(minimumScaleDelta: 0.1)             .onChanged { value in                 self.scale *= value             }         .onEnded { value in             self.scale *= value         }                  let combined = pressGesture.sequenced(before: dragGesture).simultaneously(with: pressGestureDelete).simultaneously(with: resizeGesture) And then on my view I am adding the gesture as .gesture(combined) Since iOS 15 this no longer works. Instead I can drag the view around after the long press, but as soon as I attempt a resize using the magnification gesture the whole app freezes. I have tried attaching the magnification gesture to different pieces of the view thinking that maybe it needs to be at a different level (parent/child) from the drag gesture, but I get the same behavior if there is a drag gesture and a magnification gesture in the same view. It doesn't seem to matter how I attach them, if they both exist in the same view it causes the whole app to become unresponsive. Does anyone know how to overcome this? Is this the new "intended" functionality? If so what do we do for the users who are accustomed to being able to seamlessly drag something and then resize it? Thank you in advance.
Replies
5
Boosts
1
Views
5.0k
Activity
Mar ’22