Latest 1.4.2
Homepage https://github.com/ivanbruel/TextStyle
License MIT
Platforms ios 9.0
Authors

Version
License
Platform

TextStyle provides easier management of dynamic font sizing in iOS.

Image

Benefits

With TextStyle you can support Dynamic Font Sizing in iOS, allowing font size changes through accessibility.

We also provide convenient wrappers for the NSNotificationCenter observer and also RxSwift bindings for common usage.

Available TextStyles

public enum TextStyle {

  case Title1
  case Title2
  case Headline
  case Subheadline
  case Body
  case Caption1
  case Caption2
  case Footnote
  case Callout
}

Usage

Check the Example project for a better understanding of how TextStyle works.

Without RxSwift

import TextStyle

class ViewController: UIViewController {
  let label = UILabel()

  private func viewDidLoad() {
    super.viewDidLoad()
    label.font = TextStyle.Body.font
    TextStyle.observeFontChanged(self, selector: #selector(ViewController.fontChanged))
  }

  private func fontChanged() {
    label.font = TextStyle.Body.font
  }

  deinit {
    TextStyle.removeObserver(self)
  }
}

With RxSwift

import TextStyle
import RxSwift

class ViewController: UIViewController {
  let label = UILabel()
  let disposeBag = DisposeBag()

  private func viewDidLoad() {
    super.viewDidLoad()
    TextStyle.Body.rx_font
      .bindTo(label.rx_font)
      .addDisposableTo(disposeBag)
  }
}

Reminder

iOS 9.3 (which includes the simulator) has a bug in which it doesn’t receive the notification, be sure to use either an update iOS device or the iOS 9.2 simulator.

Installation

TextStyle is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "TextStyle"

License

TextStyle is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "TextStyle",
    "version": "1.4.2",
    "summary": "TextStyle provides easier management of dynamic font sizing in iOS.",
    "description": "TextStyle easier management of dynamic font sizing in iOS. Also adds RxSwift bindings fornreactive changes.",
    "homepage": "https://github.com/ivanbruel/TextStyle",
    "license": {
        "type": "MIT",
        "file": "License"
    },
    "authors": {
        "Ivan Bruel": "[email protected]"
    },
    "social_media_url": "http://twitter.com/ivanbruel",
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/ivanbruel/TextStyle.git",
        "tag": "1.4.2"
    },
    "default_subspecs": "Core",
    "pushed_with_swift_version": "3.0",
    "subspecs": [
        {
            "name": "Core",
            "source_files": "TextStyle/Classes/*.swift",
            "frameworks": "Foundation"
        },
        {
            "name": "RxSwift",
            "source_files": "TextStyle/Classes/RxSwift/*.swift",
            "dependencies": {
                "RxSwift": [
                    "~> 3"
                ],
                "RxCocoa": [
                    "~> 3"
                ],
                "TextStyle/Core": []
            }
        }
    ]
}

Pin It on Pinterest

Share This