Skip to content

Instantly share code, notes, and snippets.

@barisuyar
Last active December 1, 2021 19:53
Show Gist options
  • Select an option

  • Save barisuyar/b90ccf7e77e7c1210bb0cf02a845fa0d to your computer and use it in GitHub Desktop.

Select an option

Save barisuyar/b90ccf7e77e7c1210bb0cf02a845fa0d to your computer and use it in GitHub Desktop.
Slider + disabling actions
@objc private func valueChanged(_ sender: Slider) {
// Step 9
CATransaction.begin()
CATransaction.setDisableActions(true)
let thumbRectA = thumbRect(forBounds: bounds,
trackRect: trackRect(forBounds: bounds),
value: value)
trackLayer.frame = .init(x: 0,
y: frame.height / 4,
width: thumbRectA.midX,
height: frame.height / 2)
// Step 9
CATransaction.commit()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment