Post

Replies

Boosts

Views

Activity

Reply to Attempting to add scrubbing to UISlider
@Claude31 I'm trying to go for something like this, where if your finger is above the slider, the values change slower. The thumb thing probably made it more confusing, so you can ignore that. Here's a video of kind of what I'm going for: https://www.dropbox.com/scl/fi/vy2deau3tdgx0nd4yogzo/ScreenRecording_08-15-2024-09-52-44_1.MP4?rlkey=xo3jlc7g6n5ervhw0ft7p01x2&st=v35wnpsk&dl=0 In the video, when I drag the thumb above the slider and move it, the values change more slowly so the thumb size also changes slowly.
Aug ’24
Reply to Attempting to add scrubbing to UISlider
Edit: I forgot to mention that I made an extension for UIColor: extension UIColor { func circle(_ size: CGSize = CGSize(width: 1, height: 1)) -> UIImage { return UIGraphicsImageRenderer(size: size).image { rendererContext in self.setFill() UIBezierPath(ovalIn: CGRect(origin: .zero, size: size)).fill() // rendererContext.fill(CGRect(origin: .zero, size: size)) } } } And the thumb is supposed to follow your touch location and grow and shrink depending on the value. Additionally, if the thumb goes past the end of the slider, translation is supposed to essentially "move" the slider so it's as if the entire slider was dragged to where you moved the thumb.
Aug ’24
Reply to Fatal crash when using CoreData and deleting item from list with Section headers
Hi! I was stuck on this too, but when I saw your comment, I had an idea. This is kind of a hacky solution, but basically I moved do { try viewContext.save() } catch { print("Failure to save context: \(error)") } to an .onDisappear function. That way the app would save the deletion only after the view is out of sight (because I'm assuming the problem lies in the ForEach statement not knowing how to update the view when its data suddenly becomes empty). I also added a condition so that it only tries to save the view context if something has been deleted. I'm a little late to the party, but I hope this helps you and/or anyone else who comes across this issue!
Feb ’24