A simple and better way to handle UIFonts in your iOS projects
You can easily handle your UIFont calls now. This is a simple and light library that will save a lot of coding time for you.
And also prevent mistype font names.
Custom font support is also available, please keep reading for details!
Check out the simple way to do it:
This library currently provides three different options for creating UIFont objects.
The first is calling the font name off of the provided Fonts enum and then calling ofSize()
to provide the desired size.
myLabel.font = Fonts.menloItalic.ofSize(16)The other method is an extension of UIFont and you can easily access by doing this:
myLabel.font = UIFont.avenirMedium(ofSize: 16)Or even this:
myLabel.font = .optimaRegular(ofSize: 16)Sure! You can easily handle your custom fonts. Just create your own enum and conform to LMFontsProtocol.
Then you can use your custom fonts without worries.
Example:
enum CustomFont: String, LMFontsProtocol {
case myFont = "myCustomFont-Bold"
}
CustomFont.myFont.ofSize(12)If you use CocoaPods to manage your dependencies, simply add
LMFonts to your Podfile:
pod 'LMFonts'
If you have interesting ideas and want to contribute to this library, you can do so by sending your pull request!
LMFonts is free software, and may be redistributed under the terms specified in the LICENSE file.