Skip to content

Commit 9d5ad75

Browse files
committed
0.8.1
1 parent ccec4e1 commit 9d5ad75

3 files changed

Lines changed: 69 additions & 0 deletions

File tree

UILabel_Typography_Extensions.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
554AF31825961B6200A23E41 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 554AF31725961B6200A23E41 /* README.md */; };
1212
55653BE625A36E0300678FD9 /* NSAttributedString+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55F7E34F25A0B32D00E7F48B /* NSAttributedString+Extensions.swift */; };
1313
559795E525A259E400A757A3 /* UIColor+Styles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 559795E425A259E400A757A3 /* UIColor+Styles.swift */; };
14+
559FB34E25A4B1A200CE795D /* LineHeightViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 559FB34D25A4B1A200CE795D /* LineHeightViewController.swift */; };
1415
55F236A225912BBE0007BC69 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55F236A125912BBE0007BC69 /* AppDelegate.swift */; };
1516
55F236A425912BBE0007BC69 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55F236A325912BBE0007BC69 /* SceneDelegate.swift */; };
1617
55F236A825912BC30007BC69 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 55F236A725912BC30007BC69 /* Assets.xcassets */; };
@@ -32,6 +33,7 @@
3233
551B425E259BCE40001310A9 /* UIFont+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIFont+Extensions.swift"; sourceTree = "<group>"; };
3334
554AF31725961B6200A23E41 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
3435
559795E425A259E400A757A3 /* UIColor+Styles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+Styles.swift"; sourceTree = "<group>"; };
36+
559FB34D25A4B1A200CE795D /* LineHeightViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineHeightViewController.swift; sourceTree = "<group>"; };
3537
55F2369E25912BBE0007BC69 /* UILabel_Typography_Extensions.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UILabel_Typography_Extensions.app; sourceTree = BUILT_PRODUCTS_DIR; };
3638
55F236A125912BBE0007BC69 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
3739
55F236A325912BBE0007BC69 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
@@ -116,6 +118,7 @@
116118
55F236B625912BF20007BC69 /* ViewController.swift */,
117119
55F7E34725A0AD7F00E7F48B /* AttributesViewController.swift */,
118120
55F7E34325A0AA5E00E7F48B /* GlyphViewController.swift */,
121+
559FB34D25A4B1A200CE795D /* LineHeightViewController.swift */,
119122
55F7E34025A0A91E00E7F48B /* LoremIpsumViewController.swift */,
120123
55F236A725912BC30007BC69 /* Assets.xcassets */,
121124
55F236AC25912BC30007BC69 /* LaunchScreen.storyboard */,
@@ -210,6 +213,7 @@
210213
55F236A225912BBE0007BC69 /* AppDelegate.swift in Sources */,
211214
55F7F0A2259A6F03001BEF90 /* Typography.swift in Sources */,
212215
55F236CA25912E690007BC69 /* PreviewView.swift in Sources */,
216+
559FB34E25A4B1A200CE795D /* LineHeightViewController.swift in Sources */,
213217
55F7E33225A03D8300E7F48B /* UILabel+Observer.swift in Sources */,
214218
55F236BB25912C430007BC69 /* Withable.swift in Sources */,
215219
55F7E34425A0AA5E00E7F48B /* GlyphViewController.swift in Sources */,
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
//
2+
// LineHeightViewController.swift
3+
// UILabel_Typography_Extensions
4+
//
5+
// Created by Geri Borbás on 05/01/2021.
6+
//
7+
8+
import UIKit
9+
10+
11+
class LineHeightViewController: UIViewController {
12+
13+
let text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
14+
15+
var label: UILabel!
16+
var sliderObserver: Observer<UISlider, Float>!
17+
18+
lazy var body = UIStackView()
19+
.vertical(spacing: 10)
20+
.views(
21+
22+
UILabel()
23+
.with(text: text)
24+
.with {
25+
$0.textColor = .label
26+
$0.font = UIFont.newYork(ofSize: 1024 / 26.0 / 2.0)
27+
$0.lineHeight = 50
28+
$0.numberOfLines = 0
29+
$0.showGrid = true
30+
$0.underline = .single
31+
self.label = $0
32+
},
33+
34+
UISlider()
35+
.with {
36+
$0.minimumValue = 50
37+
$0.maximumValue = 100
38+
$0.addTarget(self, action: #selector(didChangeSlider), for: .valueChanged)
39+
},
40+
41+
UIView
42+
.spacer
43+
.inspect
44+
)
45+
46+
@objc func didChangeSlider(_ sender: UISlider) {
47+
label.lineHeight = CGFloat(sender.value)
48+
}
49+
50+
override func viewDidLoad() {
51+
super.viewDidLoad()
52+
view.addSubview(body)
53+
view.backgroundColor = .systemBackground
54+
body.pin(
55+
to: view.safeAreaLayoutGuide,
56+
insets: UIEdgeInsets(top: 30, left: 30, bottom: 30, right: 30)
57+
)
58+
}
59+
}

UILabel_Typography_Extensions/ViewController.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class ViewController: UIViewController {
8787
.with(title: "Lorem Ipsum", target: self, selector: #selector(didTapLoremIpsumButton)),
8888
UIButton()
8989
.with(title: "Glyph", target: self, selector: #selector(didTapGlyphButton)),
90+
UIButton()
91+
.with(title: "Line Height", target: self, selector: #selector(didTapLineHeightButton)),
9092
UIView
9193
.spacer
9294
.inspect
@@ -119,6 +121,10 @@ class ViewController: UIViewController {
119121
self.present(LoremIpsumViewController(), animated: true)
120122
}
121123

124+
@objc func didTapLineHeightButton() {
125+
self.present(LineHeightViewController(), animated: true)
126+
}
127+
122128
override func viewDidLoad() {
123129
super.viewDidLoad()
124130
view.addSubview(body)

0 commit comments

Comments
 (0)