Last active
December 19, 2017 14:29
-
-
Save AttiaMo/1d6eedab4b3ea279f63b97d4f0f972ba to your computer and use it in GitHub Desktop.
Extension file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
extension UILabel { | |
var substituteFontName : String { | |
get { return self.font.fontName } | |
set { | |
if self.font.fontName.range(of:"-Bd") == nil { | |
self.font = UIFont(name: newValue, size: self.font.pointSize) | |
} | |
} | |
} | |
var substituteFontNameBold : String { | |
get { return self.font.fontName } | |
set { | |
if self.font.fontName.range(of:"-Bd") != nil { | |
self.font = UIFont(name: newValue, size: self.font.pointSize) | |
} | |
} | |
} | |
} | |
extension UITextField { | |
var substituteFontName : String { | |
get { return self.font!.fontName } | |
set { self.font = UIFont(name: newValue, size: (self.font?.pointSize)!) } | |
} | |
} | |
extension UIFont { | |
class func appRegularFontWith( size:CGFloat ) -> UIFont{ | |
return UIFont(name: Constants.App.regularFont, size: size)! | |
} | |
class func appBoldFontWith( size:CGFloat ) -> UIFont{ | |
return UIFont(name: Constants.App.boldFont, size: size)! | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment