Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gaelfoppolo/uidefaultfont


https://github.com/gaelfoppolo/uidefaultfont

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# UIDefaultFont

[![CI Status](http://img.shields.io/travis/gaelfoppolo/UIDefaultFont.svg?style=flat)](https://travis-ci.org/gaelfoppolo/UIDefaultFont)
![Swift 4](https://img.shields.io/badge/Swift-4-orange.svg)
[![Version](https://img.shields.io/cocoapods/v/UIDefaultFont.svg?style=flat)](http://cocoapods.org/pods/UIDefaultFont)
[![License](https://img.shields.io/cocoapods/l/UIDefaultFont.svg?style=flat)](http://cocoapods.org/pods/UIDefaultFont)
[![Platform](https://img.shields.io/cocoapods/p/UIDefaultFont.svg?style=flat)](http://cocoapods.org/pods/UIDefaultFont)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Documentation](https://github.com/gaelfoppolo/UIDefaultFont/blob/gh-pages/badge.svg)](https://gaelfoppolo.github.io/UIDefaultFont)
[![codecov.io](https://codecov.io/github/gaelfoppolo/UIDefaultFont/coverage.svg?branch=master)](https://codecov.io/github/gaelfoppolo/UIDefaultFont?branch=master)

Replace the system font in the whole app easily

No more wasted time and effort, searching and overriding the font of every displayed string in your app. At runtime, you can change the system font and it will be replaced everywhere it's used in the application.

This library is simply one extension to `UIFont`, adding three properties:
* `normalFontName`
* `boldFontName`
* `italicFontName`

## Usage

Simply:

```swift
UIFont.normalFontName = "Courier"
UIFont.boldFontName = "Noteworthy-Bold"
UIFont.italicFontName = "HelveticaNeue-ThinItalic"
```

If you want to be notify (to update already displayed labels for example), you can observe these three notifications:
* `normalFontChanged`
* `boldFontChanged`
* `italicFontChanged`

```swift
NotificationCenter.default.addObserver(self, selector: #selector(updateNormalFont), name: .normalFontChanged, object: nil)
```

## Requirements

* Xcode 9.0
* Swift 4

*Swift 3 support is available on the branch `swift-3` on this repository.*

## Installation

### CocoaPods

UIDefaultFont is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod 'UIDefaultFont'
```

### Carthage

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

```
github "gaelfoppolo/UIDefaultFont"
```

If you use Carthage to build your dependencies, make sure you have added `UIDefaultFont.framework` to the "_Linked Frameworks and Libraries_" section of your target, and have included `UIDefaultFont.framework` in your Carthage framework copying build phase.

### Swift Pacakge Manager

If you use Swift Pacakage Manager to manage your dependencies, simply add
UIDefaultFont to your `Package.swift`:

```swift
dependencies: [
.Package(url: "https://github.com/gaelfoppolo/UIDefaultFont.git")
]
```

## Documentation

Full documentation is available on [GitHub](https://gaelfoppolo.github.io/UIDefaultFont/). You can also install documentation locally using [jazzy](https://github.com/realm/jazzy).

## Author

Gaël Foppolo, [email protected]

## Contribution and Maintenance
System font available on iOS is surely subject to possible change,
and when it does, this library should still work properly.
If you would like to help maintain or improve this library please feel free to do so.

## License

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

[LICENSE]: /LICENSE