Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ExampleApp/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
private func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.

ConfigSetup.setup()
Expand Down
61 changes: 31 additions & 30 deletions ExampleApp/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="bfo-A9-cNO">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="16A319" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="bfo-A9-cNO">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Basic Use-->
Expand All @@ -15,31 +16,31 @@
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pxr-ee-hGH">
<rect key="frame" x="275" y="58" width="51" height="30"/>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pxr-ee-hGH">
<frame key="frameInset" minX="275" minY="58" width="51" height="30"/>
<state key="normal" title="Tap Me"/>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="This is a Headline" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fK4-F7-cIW">
<rect key="frame" x="168" y="20" width="265" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="This is a Headline" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fK4-F7-cIW">
<frame key="frameInset" minX="168" minY="20" width="265" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="NIP-E6-A0f"/>
<constraint firstAttribute="width" constant="265" id="R1d-Q4-UDV"/>
</constraints>
<fontDescription key="fontDescription" name="Georgia" family="Georgia" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Custom Style" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NFb-GH-lWO">
<rect key="frame" x="249" y="163" width="103" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Custom Style" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NFb-GH-lWO">
<frame key="frameInset" minX="249" minY="163" width="103" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="fK4-F7-cIW" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" id="1bV-KJ-f52"/>
<constraint firstItem="fK4-F7-cIW" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="FDl-gC-0vd"/>
Expand Down Expand Up @@ -69,25 +70,25 @@
<viewControllerLayoutGuide type="bottom" id="DMY-oe-Q6y"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="iwi-1t-6ma">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Big Title" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gz3-d6-KKl">
<rect key="frame" x="269" y="47" width="62" height="20"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Big Title" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gz3-d6-KKl">
<frame key="frameInset" minX="269" minY="47" width="62" height="20"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Thx-aP-MAk">
<rect key="frame" x="20" y="75" width="560" height="128"/>
<view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Thx-aP-MAk">
<frame key="frameInset" minX="20" minY="75" width="560" height="128"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LE7-eS-Qaf">
<rect key="frame" x="8" y="8" width="80" height="32"/>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LE7-eS-Qaf">
<frame key="frameInset" minX="8" minY="8" width="80" height="32"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
<state key="normal" title="Big Button"/>
</button>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="D9I-ft-qWu">
<rect key="frame" x="8" y="48" width="97" height="30"/>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="D9I-ft-qWu">
<frame key="frameInset" minX="8" minY="48" width="97" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="97" id="zP7-jN-oR3"/>
</constraints>
Expand All @@ -97,9 +98,9 @@
<outlet property="delegate" destination="VvA-21-N0E" id="JO6-ZI-6xL"/>
</connections>
</textField>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="pJ4-Uu-IJ3">
<rect key="frame" x="392" y="0.0" width="160" height="128"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" misplaced="YES" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="pJ4-Uu-IJ3">
<frame key="frameInset" minX="392" width="160" height="128"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="160" id="Bfk-Mz-WzS"/>
</constraints>
Expand All @@ -108,7 +109,7 @@
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="D9I-ft-qWu" firstAttribute="leading" secondItem="LE7-eS-Qaf" secondAttribute="leading" id="12B-M1-ADd"/>
<constraint firstItem="LE7-eS-Qaf" firstAttribute="leading" secondItem="Thx-aP-MAk" secondAttribute="leading" constant="8" id="1bt-Pn-jtN"/>
Expand All @@ -120,14 +121,14 @@
<constraint firstItem="pJ4-Uu-IJ3" firstAttribute="top" secondItem="Thx-aP-MAk" secondAttribute="top" id="wJm-fx-SiO"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Caption" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="F1m-pC-DkQ">
<rect key="frame" x="280" y="239" width="41" height="14"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Caption" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="F1m-pC-DkQ">
<frame key="frameInset" minX="280" minY="239" width="41" height="14"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption1"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="F1m-pC-DkQ" firstAttribute="centerX" secondItem="Thx-aP-MAk" secondAttribute="centerX" id="5fq-ia-NO2"/>
<constraint firstItem="gz3-d6-KKl" firstAttribute="centerX" secondItem="iwi-1t-6ma" secondAttribute="centerX" id="6LZ-2U-9tL"/>
Expand All @@ -151,7 +152,7 @@
<toolbarItems/>
<tabBar key="tabBar" contentMode="scaleToFill" id="Pe5-mL-wIN">
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</tabBar>
<connections>
<segue destination="BYZ-38-t0r" kind="relationship" relationship="viewControllers" id="wDn-3M-d91"/>
Expand Down
10 changes: 5 additions & 5 deletions ExampleApp/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ class ViewController: UIViewController {
super.viewDidLoad()

let style = "ReallyReallyBigFont"
DynamicFontRegistry.registry.addTextStyle(style,
scaledFrom: UIFontTextStyleHeadline,
DynamicFontRegistry.registry.addTextStyle(UIFontTextStyle(rawValue: style),
scaledFrom: UIFontTextStyle.headline,
byFactor: 4)

Gliphy.sharedInstance.watchLabel(heading, textStyle: UIFontTextStyleHeadline, fontName: "Georgia")
Gliphy.sharedInstance.watchButton(tapme, textStyle: UIFontTextStyleBody, fontName: "Georgia")
Gliphy.sharedInstance.watchLabel(customStyleLabel, textStyle: "ReallyReallyBigFont", fontName: "Helvetica")
Gliphy.sharedInstance.watchLabel(heading, textStyle: UIFontTextStyle.headline, fontName: "Georgia")
Gliphy.sharedInstance.watchButton(tapme, textStyle: UIFontTextStyle.body, fontName: "Georgia")
Gliphy.sharedInstance.watchLabel(customStyleLabel, textStyle: UIFontTextStyle(rawValue: "ReallyReallyBigFont"), fontName: "Helvetica")
}
}

12 changes: 6 additions & 6 deletions ExampleApp/WatcherViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import UIKit
struct ConfigSetup {
static func setup() {
var config = StyleConfig()
config.label[UIFontTextStyleHeadline] = "Verdana"
config.label[UIFontTextStyleCaption1] = "MarkerFelt-Thin"
config.button[UIFontTextStyleHeadline] = "Verdana"
config.textField[UIFontTextStyleBody] = "Verdana"
config.textField[UIFontTextStyleCaption1] = "Helvetica"
config.label[UIFontTextStyle.headline] = "Verdana"
config.label[UIFontTextStyle.caption1] = "MarkerFelt-Thin"
config.button[UIFontTextStyle.headline] = "Verdana"
config.textField[UIFontTextStyle.body] = "Verdana"
config.textField[UIFontTextStyle.caption1] = "Helvetica"
StyleWatcher.defaultConfig = config
}
}
Expand All @@ -29,7 +29,7 @@ class WatcherViewController: UIViewController, UITextFieldDelegate {
watcher.watchViews(inView: view)
}

func textFieldShouldReturn(textField: UITextField) -> Bool {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
Expand Down
Loading