I have a strange crash on iOS device (EXC_BAD_INSTRUCTION). I have a custom UIControl called ScrollingScrubber and all it has is a UIScrollView, and it fires .valueChanged events when user is scrolling. That's where sometimes the crash happens and I have no idea how to debug it further.
var value:CGFloat = 0
override open func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
isUserDragging = scroller.isDragging
if isUserDragging {
sendActions(for: .editingDidBegin)
}
return isUserDragging
}
override open func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
value = (scroller.contentOffset.y + scroller.contentInset.top)/(scroller.contentSize.height)
sendActions(for: .valueChanged) //It sometimes crashes here with EXC_BAD_INSTRUCTION, why?????
return true
}