Skip to content

Instantly share code, notes, and snippets.

@fieldAbyss
Created December 10, 2018 05:19
Show Gist options
  • Save fieldAbyss/9efea7e116be7d490b9fbcf1e73c9b2e to your computer and use it in GitHub Desktop.
Save fieldAbyss/9efea7e116be7d490b9fbcf1e73c9b2e to your computer and use it in GitHub Desktop.
'UIEdgeInsetsInsetRect' has been replaced by instance method 'CGRect.inset(by:)'
class IndentedLabel: UILabel {
override func drawText(in rect: CGRect) {
let insets = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 0)
// let customRect = UIEdgeInsetsInsetRect(rect, insets) Swift 4.0
// Swift 4.2~
let customRect = rect.inset(by: insets)
super.drawText(in: customRect)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment