Skip to content

Instantly share code, notes, and snippets.

@AndyDentFree
Created February 17, 2022 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndyDentFree/d91fe267fd6c4ca994e1bf6d4e8fec7a to your computer and use it in GitHub Desktop.
Save AndyDentFree/d91fe267fd6c4ca994e1bf6d4e8fec7a to your computer and use it in GitHub Desktop.
Code reacting to a UI Slider updating line width to outline text.
fileprivate func updatePreviewFromThicknessChange() {
if thicknessAdjuster.value != lineWidth {
thicknessSwatch.setNeedsDisplay() // refresh assuming value adjusted
lineWidth = thicknessAdjuster.value
textStyle.drawStyle = textStyle.drawStyle.butWith(
lineWidthTenths: Int(lineWidth*10))
updateFontStyling()
updateFontDisplay()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment