iOS Framework with a bunch of classes and helpers for Swift.
Swift HTML Ruby Other
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Taylor.xcodeproj Update BuildableName for target "Taylor-iOS" Jun 1, 2018
Taylor Add tvOS support (#48) Jun 1, 2018
TaylorTests
docs/1.0 Update documentation + add Gem file for Jazzy Nov 7, 2016
fastlane Update BuildableName for target "Taylor-iOS" Jun 1, 2018
.gitignore Rename files to include "+Taylor" Apr 1, 2016
.jazzy.yaml Add documentation built with Jazzy Aug 25, 2016
.swift-version Add Travis + Fastlane Dec 15, 2017
.swiftlint.yml Update to swift 3.0 Sep 14, 2016
.travis.yml update Dec 15, 2017
Gemfile update Dec 15, 2017
Gemfile.lock update Dec 15, 2017
LICENSE.md Add License file Aug 25, 2016
MRGTaylor.podspec Add tvOS support (#48) Jun 1, 2018
README.md Add tvOS support (#48) Jun 1, 2018
build_doc.sh Update documentation + add Gem file for Jazzy Nov 7, 2016
install_all.sh Release 0.0.1. Mar 20, 2018

README.md

Taylor

iOS Framework with a bunch of classes and helpers for Swift.

Requirements

  • iOS 8.0+, tvOS 9.0+
  • Xcode 9.4
  • Swift 4 (use the v1.1 tag if you need Swift < 2.3 support)

Installation

You can use Carthage to install Taylor by adding it to your Cartfile:

github "mirego/taylor-ios"

CocoaPods

You can use CocoaPods to install Taylor by adding it to your Podfile:

pod 'MRGTaylor'

Manually

  1. Download and drop the Swift file you need in your project.
  2. Congratulations!

Usage example

import Taylor

let button = UIButton(type: .Custom)
button.setBorder(width: 2, color: .redColor())

Safe area insets

Taylor provides a backward compatible version of safeAreaInsets property for UIView. The original API is available on iOS 11 and above and the replacement fills the gap on older OS version (iOS 7 to 10 inclusively). It is an opt-in feature that requires to be enabled in order to work.

To enable the feature, place this piece of code the earliest possible in your AppDelegate's application:didFinishLaunching:withOptions method:

UIViewController.enableCompatibilitySafeAreaInsets()

Your can now access the compatibilitySafeAreaInsets property from any UIView. On iOS 11 and above, this property returns safeAreaInsets. To receive safe area update callbacks, your view must conform to the CompatibilitySafeAreaInsetsUpdate protocol.

To cover every iOS versions, your subview could look like this:

class BaseView: UIView, CompatibilitySafeAreaInsetsUpdate {
    func compatibilitySafeAreaInsetsDidChange() {
        commonSafeAreaInsetsDidChange()
    }

    @available(iOS 11.0, *)
    override func safeAreaInsetsDidChange() {
        super.safeAreaInsetsDidChange()
        commonSafeAreaInsetsDidChange()
    }

    func commonSafeAreaInsetsDidChange() {
        setNeedsLayout()
    }
}

Bonus

  • There is a no-bitcode branch that's (hopefully) kept up to date with the master.

License

Taylor is © 2016 Mirego and may be freely distributed under the New BSD license. See the LICENSE.md file.

About Mirego

Mirego is a team of passionate people who believe that work is a place where you can innovate and have fun. We're a team of talented people who imagine and build beautiful Web and mobile applications. We come together to share ideas and change the world.

We also love open-source software and we try to give back to the community as much as we can.