Font management (System & Custom) for iOS and tvOS

Overview

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.

Comments
  • [Accessibility] Added Dynamic Type support

    [Accessibility] Added Dynamic Type support

    Current State

    All created UIFonts are fixed to a certain size. Creating scalable (Dynamic Type) font objects requires some boilerplate code in the client app importing this package.

    Why Dynamic Type?

    For accessibility reasons apps should user scalable (Dynamic Type) fonts rather than ones with fixed font sizes. If users increase/decrease font sizes in their settings, fixed fonts would not change, Dynamic Type fonts would do that.

    Updates

    This small addition adds two new methods that make it very easy to create Dynamic Type supporting UIFont objects. The methods use the native UIFont.TextStyle, the default is .body.

    Usage

    // Default is UIFont.TextStyle.body
    
    label.font = UIFont.scaled(font: .avenirMedium)
    label.font = BuiltInFont.avenirMedium.scaledFont()
    
    // Example with other text styles
    
    label.font = UIFont.scaled(font: .avenirMedium, textStyle: .headline)
    label.font = BuiltInFont.avenirMedium.scaledFont(textStyle: .title3)
    

    Quick Demo video in Simulator:

    https://user-images.githubusercontent.com/35889530/193431052-9b7dc4bb-793e-4097-9e7b-b39e314ed428.mov

    opened by misteu 5
  • can not find the method in UIFont extension

    can not find the method in UIFont extension

    Hi Norma:

    I find that the main ViewController can not find the convenience init method in UIFont extension when using CoCoaPods. I wonder weather or not apple have change the access level in extension when using "puclib" key word.

    font demo
    opened by sishenyihuba 3
  • Consolidation and organization of `Font.swift`

    Consolidation and organization of `Font.swift`

    • Removed duplicate entries by interleaving fonts that are common to both platforms with ones that are found only on one or the other. This shaved off about 200 lines.
    • Alphabetized case names.
    • Added // MARKs to make it easier to navigate down the list.

    All tests on both iOS and tvOS passed.

    opened by jrtibbetts 2
  • pod install not working

    pod install not working

    Xcode 9.4, Swift 4.1

    on a pod install, I get

    Analyzing dependencies
    Downloading dependencies
    Using Alamofire (4.7.2)
    Installing UIFontComplete (3.0.0)
    
    [!] Error installing UIFontComplete
    [!] /usr/bin/git clone https://github.com/Nirma/UIFontComplete.git /var/folders/20/1t97f44x137cf4qnmv9b6ydr0000gn/T/d20180602-33098-af05of --template= --single-branch --depth 1 --branch 3.0.0
    
    Cloning into '/var/folders/20/1t97f44x137cf4qnmv9b6ydr0000gn/T/d20180602-33098-af05of'...
    fatal: unable to access 'https://github.com/Nirma/UIFontComplete.git/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
    
    opened by AustinDu 2
  • Feature for custom fonts

    Feature for custom fonts

    Hi, Nirma.

    enum Font cannot extend or define custom fonts, so I added FontRepresentable protocol (I don't know it's good naming..).

    If you are using custom fonts, this protocol makes it possible to use func of(size:_).

    e.g.

    // In your project using custom fonts
    
    enum CustomFont: String, FontRepresentable {
        case alexBrushRegular = "AlexBrush-Regular"
    }
    
    CustomFont.alexBrushRegular.of(size: 12.0) // => UIFont
    
    opened by matsune 2
  • FREE YouTube VIDEO TUTORIAL

    FREE YouTube VIDEO TUTORIAL

    Hi, Love UIFontComplete. So I made a 25 minutes long YouTube tutorial explaining it: https://youtu.be/JegutXcer60

    Feel free to add it to the README / Documentation / Cheat Sheet with this image [people tap on images more than on boring links :) ] EasyUIFont

    Hope you like it. I'm open to any feedback.

    opened by rebeloper 1
  • Update .travis.yml

    Update .travis.yml

    Travis CI sometimes has multiple simulator options for the same OS and device name so not specifying an explicit id would sometimes cause an ambiguity but recently that issue seems to have been fixed.

    Not explicitly specifying an id is more flexible and CI should break less often.

    opened by Nirma 1
Releases(6.1.0)
  • 6.1.0(Oct 18, 2022)

    Summary

    This release adds dynamic type support via: https://github.com/Nirma/UIFontComplete/pull/43

    Thank you @misteu for putting this together!

    Source code(tar.gz)
    Source code(zip)
  • 6.0.0(Mar 10, 2022)

  • 5.0.0(Jul 12, 2020)

    Summary

    This release removes some deprecated fonts and updates which fonts are available on iOS and tvOS. Some fonts are available on both platforms now, some other fonts have also been added and deleted.

    Since some fonts have been retired this technically is a breaking release but not because of functionality being added or removed from this library.

    If I forgot anything or you feel that something could be done better by all means FEEL FREE TO CONTRIBUTE!


    P.S. 2020 is turning out to be an unstable year, looks like all bets are off at this point. Please stay safe and take care.

    ~ Nicko

    Source code(tar.gz)
    Source code(zip)
  • 4.0.1(Jan 16, 2020)

  • 4.0.0(Apr 8, 2019)

  • 3.0.0(Jan 2, 2018)

  • 2.0.1(Sep 23, 2017)

  • 2.0.0(Sep 20, 2017)

    Swift 4 Support!

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

    Enjoy!

    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Aug 28, 2017)

    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
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Jun 26, 2017)

    This release marks this library as officially production ready.

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

    Source code(tar.gz)
    Source code(zip)
  • 0.4.0(Jun 5, 2017)

    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.

    Source code(tar.gz)
    Source code(zip)
  • 0.3.0(Apr 28, 2017)

    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!

    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(Apr 18, 2017)

    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!

    Source code(tar.gz)
    Source code(zip)
  • 0.1.1(Apr 14, 2017)

  • 0.1.0(Dec 15, 2016)

Owner
Nicholas Maccharoli
Day job is iOS / Swift dev mostly, Python and Golang enthusiast. Coding with love since 2007.
Nicholas Maccharoli
OS font complements library. Localized font supported.

SwiftFontName SwiftFontName is font name complements and supports localized font library. You don't need to search font name any more with SwiftFontNa

Morita Naoki 114 Nov 3, 2022
Auto-generated icon font library for iOS, watchOS and tvOS

Iconic helps making icon fonts integration effortless on iOS, tvOS and watchOS. Its main component is in charge of auto-generating strongly typed Swif

Home Assistant 1.6k Nov 12, 2022
This projects shows how we can server-side add/update "ANY" custom font in a live iOS App without needing to update the app.

Server-side-Dynamic-Fonts This projects shows how we can server-side add/update "ANY" custom font in a live iOS App without needing to update the app.

null 2 Mar 26, 2022
Icons fonts for iOS (Font Awesome 5, Iconic, Ionicon, Octicon, Themify, MapIcon, MaterialIcon, Foundation 3, Elegant Icon, Captain Icon)

Installation SPM Not yet supported. Please use Cocoapods or Carthage Carthage github "0x73/SwiftIconFont" Cocoapods CocoaPods is a dependency manager

sedat รงiftรงi 1.1k Dec 14, 2022
Google Material Design Icons Font for iOS

GoogleMaterialDesignIcons #Google Material Design Icons Font for iOS It is based on https://github.com/google/material-design-icons. it converts the m

Yuji Hato 365 Oct 19, 2022
Font Awesome swift library for iOS.

Font Awesome Swift Follow me: @vaberer I like โ˜…. Do not forget to โ˜… this super convenient library. Added UISegmentedControl & UITabbarItem & UISlider

Patrick Vaberer 746 Dec 17, 2022
OpenSansSwift - Easily use the OpenSans font in Swift.

OpenSansSwift Easily use the OpenSans font in Swift. Why use OpenSansSwift frameworks ? The usual process of embedding any custom fonts in your IOS ap

Hemant Sapkota 42 Jan 29, 2022
๐ŸŽข Swift Library for Font Icons

Swift Library for Font Icons Please โ˜… this library. Now, you don't have to download different libraries to include different font icons. This SwiftIco

Saurabh Rane 781 Dec 6, 2022
SwiftUIFontIcon The easiest way to implement font icons in your SwiftUI project.

SwiftUIFontIcon The easiest way to implement font icons in your SwiftUI project. Usage The library is super super easy to use, just something like thi

Bui Dac Huy 81 Dec 27, 2022
Font Awesome support in Swift

MCFontAwesome Font Awesome v4.1.0 for Swift Font aliases has not been ported yet, in order to refer to a font you have to strip all the - (minus) insi

Matteo Crippa 19 Jun 9, 2020
Programmatically load custom fonts into your iOS and tvOS app.

FontBlaster Programmatically load custom fonts into your iOS and tvOS app. About Say goodbye to importing custom fonts via property lists as FontBlast

Arthur Ariel Sabintsev 1.1k Jan 3, 2023
An inkwell to use custom fonts on the fly.

Inkwell Introduction In brief, Inkwell is a font library to use custom fonts on the fly. Inkwell takes responsibilities for: Downloading fonts from Go

Vinh Nguyen 151 Oct 10, 2022
SwiftUI Custom Fonts with working Xcode Previews

SwiftUI Custom Fonts with working Xcode Previews This is a small SwiftUI only app that demonstrates how to use custom fonts, where the custom fonts ar

Jeremy Gale 9 Aug 24, 2022
Use 1600+ icons (and more!) from FontAwesome and Google Material Icons in your swift/iOS project in an easy and space-efficient way!

Swicon Use 1600+ icons from FontAwesome and Google Material Icons in your iOS project in an easy and space-efficient way! The built-in icons are from

Zhibo 39 Nov 3, 2022
Google Material Design Icons for Swift and ObjC project

GoogleMaterialIconFont Google Material Design Icons for Swift and ObjC project This library is inspired by FontAwesome.swift Both Swift and Objctive-C

Yusuke Kita 146 Nov 8, 2022
Generator of settings icon by SF Symbols. Customisable background color and ready-use in table cell.

SPSettingsIcons Generate settings icons by Apple's SF Symbols. For safe using SFSymbols see SPSafeSymbols library. Installation Swift Package Manager

Sparrow Code 110 Dec 28, 2022
A better choice for iOS Developer to use FontAwesome Icon with UI.๐Ÿ˜

FontAwesomeKit.Swift ?? ?? A better choice for iOS Developer to use FontAwesome Icon with UI. ?? Support Swift 4.2 & iOS 8.0+ FontAwesome 4.7.0 Storyb

Qiun Cheng 192 May 16, 2022
Pretendard Fonts for iOS (Swift Package Manager)

PretendardKit Pretendard 1.3.3 ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•ฉ๋‹ˆ๋‹ค. Install (Swift Package Manager) dependencies: [ .package(url: "https://github.com/wookeon/PretendardKit

Darth Vader 1 Jun 2, 2022
Icon font library for iOS. Currently supports Font-Awesome, Foundation icons, Zocial, and ionicons.

FontAwesomeKit Icon font library for iOS. Currently supports Font-Awesome, Foundation icons, Zocial, and ionicons. Version 2.2 Notable Changes Not Jus

Pride Chung 2.8k Jan 6, 2023
OS font complements library. Localized font supported.

SwiftFontName SwiftFontName is font name complements and supports localized font library. You don't need to search font name any more with SwiftFontNa

Morita Naoki 114 Nov 3, 2022