Skip to content

Commit ef621cb

Browse files
committed
0.11.0
1 parent 4ebafb0 commit ef621cb

5 files changed

Lines changed: 133 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44

55
+ (May) lookup baseline reset issue with overflowing text
66

7+
* 0.10.0 - 0.11.0
8+
9+
+ Added `MarsViewController`
10+
711
* Feature/Label_Styles/0.1.5
812

913
+ Moved constants into `UI`
1014
+ Added `MockupViewController`
11-
1215

1316
* Feature/Label_Styles/0.1.3 - 0.1.4
1417

UILabel_Typography_Extensions.xcodeproj/project.pbxproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
551B425F259BCE40001310A9 /* UIFont+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 551B425E259BCE40001310A9 /* UIFont+Extensions.swift */; };
1515
554AF31825961B6200A23E41 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 554AF31725961B6200A23E41 /* README.md */; };
1616
5558DA4627DA1FA900A4A178 /* MockupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5558DA4527DA1FA900A4A178 /* MockupViewController.swift */; };
17+
55722E1E27DB6167002DE7DC /* MarsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55722E1D27DB6167002DE7DC /* MarsViewController.swift */; };
18+
55722E1F27DB63BC002DE7DC /* PlanetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 559E70FC27D90D0E00C00AD7 /* PlanetViewController.swift */; };
1719
559795E525A259E400A757A3 /* UIColor+Styles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 559795E425A259E400A757A3 /* UIColor+Styles.swift */; };
18-
559E70FD27D90D0E00C00AD7 /* PlanetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 559E70FC27D90D0E00C00AD7 /* PlanetViewController.swift */; };
1920
559FB34E25A4B1A200CE795D /* LineHeightViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 559FB34D25A4B1A200CE795D /* LineHeightViewController.swift */; };
2021
55A3EECE27D7F24C0002193A /* UIFont+Inspection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55A3EECD27D7F24C0002193A /* UIFont+Inspection.swift */; };
2122
55BB9AD127D9685700599A5E /* Styles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55BB9AD027D9685700599A5E /* Styles.swift */; };
@@ -45,6 +46,7 @@
4546
554A2DCF27D67B66008A4AE4 /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = "<group>"; };
4647
554AF31725961B6200A23E41 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
4748
5558DA4527DA1FA900A4A178 /* MockupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockupViewController.swift; sourceTree = "<group>"; };
49+
55722E1D27DB6167002DE7DC /* MarsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarsViewController.swift; sourceTree = "<group>"; };
4850
559795E425A259E400A757A3 /* UIColor+Styles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+Styles.swift"; sourceTree = "<group>"; };
4951
559E70FC27D90D0E00C00AD7 /* PlanetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlanetViewController.swift; sourceTree = "<group>"; };
5052
559FB34D25A4B1A200CE795D /* LineHeightViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineHeightViewController.swift; sourceTree = "<group>"; };
@@ -109,6 +111,7 @@
109111
isa = PBXGroup;
110112
children = (
111113
5558DA4527DA1FA900A4A178 /* MockupViewController.swift */,
114+
55722E1D27DB6167002DE7DC /* MarsViewController.swift */,
112115
559E70FC27D90D0E00C00AD7 /* PlanetViewController.swift */,
113116
55BB9AD027D9685700599A5E /* Styles.swift */,
114117
);
@@ -252,6 +255,7 @@
252255
55F7F0A2259A6F03001BEF90 /* Typography.swift in Sources */,
253256
55F236CA25912E690007BC69 /* PreviewView.swift in Sources */,
254257
5501DB9327D81EC9009E0FDA /* ManualViewController.swift in Sources */,
258+
55722E1F27DB63BC002DE7DC /* PlanetViewController.swift in Sources */,
255259
559FB34E25A4B1A200CE795D /* LineHeightViewController.swift in Sources */,
256260
5501DB9727D8240E009E0FDA /* UIButton+Styles.swift in Sources */,
257261
55F7E33225A03D8300E7F48B /* UILabel+Observer.swift in Sources */,
@@ -261,10 +265,10 @@
261265
55A3EECE27D7F24C0002193A /* UIFont+Inspection.swift in Sources */,
262266
55F236A425912BBE0007BC69 /* SceneDelegate.swift in Sources */,
263267
551B425F259BCE40001310A9 /* UIFont+Extensions.swift in Sources */,
264-
559E70FD27D90D0E00C00AD7 /* PlanetViewController.swift in Sources */,
265268
5501DB9527D82099009E0FDA /* UIButton+Extensions.swift in Sources */,
266269
55F7E34125A0A91E00E7F48B /* LoremIpsumViewController.swift in Sources */,
267270
559795E525A259E400A757A3 /* UIColor+Styles.swift in Sources */,
271+
55722E1E27DB6167002DE7DC /* MarsViewController.swift in Sources */,
268272
55BB9AD127D9685700599A5E /* Styles.swift in Sources */,
269273
5558DA4627DA1FA900A4A178 /* MockupViewController.swift in Sources */,
270274
55F7E34825A0AD7F00E7F48B /* AttributesViewController.swift in Sources */,

UILabel_Typography_Extensions/Menu/MenuViewController.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ class MenuViewController: UIViewController {
6767
.onTouchUpInside { [unowned self] in
6868
self.present(MockupViewController(), animated: true)
6969
},
70+
UIButton()
71+
.with(title: "Mars")
72+
.onTouchUpInside { [unowned self] in
73+
self.present(MarsViewController(), animated: true)
74+
},
7075
UIButton()
7176
.with(title: "Planet")
7277
.onTouchUpInside { [unowned self] in
@@ -90,7 +95,7 @@ class MenuViewController: UIViewController {
9095
override func viewDidAppear(_ animated: Bool) {
9196
super.viewDidAppear(animated)
9297

93-
self.present(MockupViewController().with {
98+
self.present(MarsViewController().with {
9499
$0.modalPresentationStyle = .fullScreen
95100
}, animated: true)
96101
}
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
//
2+
// MarsViewController.swift
3+
// UILabel_Typography_Extensions
4+
//
5+
// Created by Geri Borbás on 11/03/2022.
6+
//
7+
8+
import UIKit
9+
import SwiftUI
10+
11+
12+
class MarsViewController: UIViewController {
13+
14+
lazy var stackView = UIStackView().with {
15+
$0.axis = .vertical
16+
$0.spacing = 5
17+
[
18+
UILabel().with {
19+
$0.textColor = UIColor(named: "Mars")
20+
$0.font = UIFont(name: "HelveticaNeue-CondensedBlack", size: 100)
21+
$0.lineHeight = 80
22+
$0.letterSpacing = 100 * -0.02
23+
$0.text = "Mars"
24+
},
25+
UILabel().with {
26+
$0.textColor = .label
27+
$0.font = UIFont(name: "HelveticaNeue", size: 20)
28+
$0.lineHeight = 30
29+
$0.letterSpacing = 20 * 0.28
30+
$0.text = "Martian (/ˈmɑːrʃən/)"
31+
},
32+
UIImageView(image: .init(named: "Mars")),
33+
UILabel().with {
34+
$0.textColor = .label
35+
$0.font = UIFont(name: "HelveticaNeue-Medium", size: 12)
36+
$0.numberOfLines = 0
37+
$0.lineHeight = 20
38+
$0.letterSpacing = 12 * 0.30
39+
$0.text = "Mars is the fourth planet from the Sun and the second-smallest planet in the Solar System, being larger than only Mercury. In English, Mars carries the name of the Roman god of war and is often referred to as the \"Red Planet\". The latter refers to the effect of the iron oxide prevalent on Mars's surface.".uppercased()
40+
},
41+
UILabel().with {
42+
$0.textColor = .label
43+
$0.font = UIFont(name: "HelveticaNeue-Bold", size: 21)
44+
$0.numberOfLines = 0
45+
$0.lineHeight = 30
46+
$0.letterSpacing = 21 * 0.10
47+
$0.underline = .single
48+
$0.text = "History"
49+
},
50+
UILabel().with {
51+
$0.textColor = .label.withAlphaComponent(0.5)
52+
$0.font = UIFont(name: "HelveticaNeue-Medium", size: 13)
53+
$0.numberOfLines = 0
54+
$0.lineHeight = 20
55+
$0.text = "The days and seasons are comparable to those of Earth, because the rotation period as well as the tilt of the rotational axis relative to the ecliptic plane are similar. Mars is the site of Olympus Mons, the largest volcano and highest known mountain on any planet in the Solar System, and of Valles Marineris, one of the largest canyons in the Solar System. The smooth Borealis basin in the Northern Hemisphere covers 40% of the planet and may be a giant impact feature. Mars has two moons, Phobos and Deimos, which are small and irregularly shaped.\n\nMars has been explored by several uncrewed spacecraft. Mariner 4 was the first spacecraft to visit Mars; launched by NASA on 28 November 1964, it made its closest approach to the planet on 15 July 1965. Mariner 4 detected the weak Martian radiation belt, measured at about 0.1% that of Earth, and captured the first images of another planet from deep space. The latest spacecraft to successfully land on Mars are CNSA's Tianwen-1 lander and Zhurong rover, landed on 14 May 2021."
56+
}
57+
].add(to: $0)
58+
}
59+
.views(
60+
61+
)
62+
.with {
63+
$0.setCustomSpacing(30, after: $0.subviews[3])
64+
$0.setCustomSpacing(30, after: $0.subviews[4])
65+
}
66+
67+
lazy var scrollView = UIScrollView()
68+
.with {
69+
$0.clipsToBounds = false
70+
}
71+
72+
override func viewDidLoad() {
73+
super.viewDidLoad()
74+
75+
// Colors.
76+
view.backgroundColor = UI.Color.background
77+
overrideUserInterfaceStyle = .dark
78+
79+
// Hierarchy.
80+
view.addSubview(scrollView)
81+
scrollView.addSubview(stackView)
82+
scrollView.pin(
83+
to: view.safeAreaLayoutGuide,
84+
insets: .zero
85+
)
86+
stackView.pin(
87+
to: scrollView,
88+
insets: UI.padding
89+
)
90+
91+
// Vertical scrolling.
92+
stackView.widthAnchor.constraint(
93+
equalTo: scrollView.widthAnchor,
94+
constant: -UI.padding.left - UI.padding.right
95+
).isActive = true
96+
}
97+
}
98+
99+
100+
fileprivate extension Array where Element: UIView {
101+
102+
func add(to stackView: UIStackView) {
103+
forEach { stackView.addArrangedSubview($0) }
104+
}
105+
}
106+
107+
108+
struct MarsViewController_Previews: PreviewProvider {
109+
static var previews: some View {
110+
Group {
111+
PreviewView(for: MarsViewController())
112+
.environment(\.colorScheme, .light)
113+
.edgesIgnoringSafeArea(.all)
114+
}
115+
}
116+
}
117+

UILabel_Typography_Extensions/Menu/Planet/Styles.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ extension UILabel {
5050
.with {
5151
$0.textColor = UI.Color.label
5252
$0.font = UIFont(name: "HelveticaNeue", size: 20)
53-
$0.adjustsFontSizeToFitWidth = false
5453
$0.lineHeight = 30
5554
$0.letterSpacing = 20 * 0.28
5655
}

0 commit comments

Comments
 (0)