Skip to content

Instantly share code, notes, and snippets.

@dimohamdy
Last active January 22, 2017 10:00
Show Gist options
  • Save dimohamdy/c47992e14c1a3ee3315c06e2480e121e to your computer and use it in GitHub Desktop.
Save dimohamdy/c47992e14c1a3ee3315c06e2480e121e to your computer and use it in GitHub Desktop.
Change Font name Without change font size
UILabel.appearance().defaultFont = UIFont.systemFont(ofSize: 15/*Any Value*/, weight: UIFontWeightThin)
extension UILabel{
dynamic var defaultFont: UIFont? {
get { return self.font }
set {
let sizeOfOldFont = self.font.pointSize
let fontNameOfNewFont = newValue?.fontName
self.font = UIFont(name: fontNameOfNewFont!, size: sizeOfOldFont)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment