Swiftpack.co - Package - Nirma/UIFontComplete

UIFontComplete

Build Status Swift 5.0 platforms CodeCov CocoaPods compatible Carthage compatible Swift Package Manager compatible License

Font management (System & Custom) for iOS and tvOS

Usage

No more wasted time searching for names of UIFont fonts and no more surprises at runtime if a font name was mistyped. This library is simply one extension to UIFont and one Font enum with a case for each system font on iOS and tvOS. Custom font support is also available, please keep reading for details!

Instead of using the String based constructor native to UIFont:

let font = UIFont(name: "Arial-BoldItalicMT", size: 12.0)

You can now simply start typing the name of the font enum and let code completion help you:

This library currently provides two different options for creating UIFont objects. The first is calling the font name off of the provided Font enumeration and then calling of(size:) to provide the desired size.

let myFont = Font.helvetica.of(size: 12.0)

The other UIFont creation method offered by this library is similar to the normal UIFont constructor except that instead of providing a String of the desired font, a case of the Font enum is provided instead.

let font = UIFont(font: .arialBoldItalicMT, size: 12.0)

What about Custom Fonts?

Custom Fonts can be added with the help of the FontRepresentable protocol. Simply create your own CustomFont String based enumeration that adapts the FontRepresentable and add a case per font that you want to add like so:

// In your project using custom fonts

enum CustomFont: String, FontRepresentable {
    case alexBrushRegular = "AlexBrush-Regular"
}

CustomFont.alexBrushRegular.of(size: 12.0) // => UIFont

Installation

Carthage

If you use Carthage to manage your dependencies, simply add UIFontComplete to your Cartfile:

github "Nirma/UIFontComplete"

If you use Carthage to build your dependencies, make sure you have added UIFontComplete.framework to the "Linked Frameworks and Libraries" section of your target, and have included UIFontComplete.framework in your Carthage framework copying build phase.

CocoaPods

If you use CocoaPods to manage your dependencies, simply add UIFontComplete to your Podfile:

pod 'UIFontComplete'

Requirements

  • Xcode 9.0
  • Swift 4.0+

Contributing to UIFontComplete

Pull Requests are Welcome! If you feel that this library could be made better then please do so by sending over a pull request!

License

UIFontComplete is free software, and may be redistributed under the terms specified in the LICENSE file.

Github

link
Stars: 1190

Dependencies

Used By

Total: 0

Releases

The Package - 2020-01-16 00:41:39

This release fixes package manager support.

Thanks @nuudles for putting this together!

Swift 5 - 2019-04-08 15:43:03

This is simply a project modernization release, no major code changes.

TV - 2018-01-02 15:28:04

This release introduces support for tvOS fonts.

Swifty Fix - 2017-09-23 11:10:33

This release fixes an issue with cocoapods in a previous release.

Enjoy!

Swift 4 - 2017-09-20 08:40:11

Swift 4 Support!

This release contains no new code changes, only updated project settings so that the project be compiled in Swift 4.

Enjoy!

Alphabet Soup - 2017-08-28 06:37:01

This is a minor release with the following changes

Changes

  • The System font enum has been reorganized in Alphabetical order
  • Tests have been moved to top level "Tests" folder
  • Non essential code has been removed

SRFTW - 2017-06-26 01:09:04

This release marks this library as officially production ready.

Swift Package Manager support has also been added but is currently experimental.

Amplifier - 2017-06-05 08:54:39

This is just a minor additive release that introduces a convenience method for of(size:) that allows the use of the more natural Double type rather than forcing the user to use a CGFloat.

Fonts just for you! - 2017-04-28 02:31:44

This release enables the use of custom fonts thanks to the addition of FontRepresentable. Please see the README for details!

Thanks @matsune for putting this together!

Fellowship of UIFont - 2017-04-18 03:32:16

This release introduces a handy extension to Font that takes a size and returns a UIFont object. See the updated README for details!

@jrtibbetts Thanks for making this!

UIFCFTW - 2017-04-14 10:19:52

Minor improvements, not API additions.

Enjoy!

Power of Enums - 2016-12-15 17:46:33

First Release!