I’m engaged on an iOS app the place I’ve an AnyArtboardEvent technique that pushes snapshots into my undo/redo stack.
Right here’s a simplified model of it:
func AnyArtboardEvent(mergedImaged: UIImage = UIImage()) {
self.undoRedo?.Add(worth: self.SlotViewsToCollection(mergedImage: mergedImaged))
self.UpdateControllerForActiveSlot()
}
The Add technique in my UndoRedo class simply appends values to a group (no recursion there).
func Add(worth: SlotViewCollection) {
var pointerTemp: Int = self.pointer
pointerTemp = pointerTemp + 1
self.pointer = pointerTemp
self.CheckValueAtIndex(worth)
self.EnsureCollectionSize()
}
Challenge is that when person finishes interacting with a slider, I name AnyArtboardEvent contained in the .ended section of my contact occasion handler:
if let touchEvent = occasion.allTouches?.first {
swap touchEvent.section {
case .ended:
self.isAnyThingChange = true
self.AnyArtboardEvent() //
However after debugging:
When the slider interplay ends, AnyArtboardEvent known as 3 times.
The primary name is predicted, however the second and third calls occur instantly afterward (with out me explicitly calling them).
I added a symbolic breakpoint and confirmed that every one three calls originate from this .ended block.
I additionally checked the InitCaLayer technique (which provides a border CAShapeLayer), nevertheless it doesn’t name AnyArtboardEvent.
Thus far, I couldn’t discover something in my code that may trigger AnyArtboardEvent to run a number of occasions.
Is it doable that touchesEnded / .ended section is firing a number of occasions for the slider gesture?
Or may including layers (CAShapeLayer) not directly set off format passes that fireside the contact occasion handler once more?
How can I guarantee AnyArtboardEvent known as solely as soon as per slider interplay?