Skip to content

Instantly share code, notes, and snippets.

@michaelevensen
Created November 19, 2019 10:12
Show Gist options
  • Save michaelevensen/846803f2fd4873c2b601a223dcf288e9 to your computer and use it in GitHub Desktop.
Save michaelevensen/846803f2fd4873c2b601a223dcf288e9 to your computer and use it in GitHub Desktop.
MinMax Example
// min(max()) example for scrolling
let minValue: CGFloat = 0
let maxValue: CGFloat = 1
let dynamicValue = (trackCell.trackImageView.frame.size.height - locationY) / trackCell.trackImageView.frame.size.height
let delta = min(maxValue, max(minValue, dynamicValue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment