Skip to content

Commit 712be54

Browse files
committed
0.1.3
1 parent 36b20d0 commit 712be54

5 files changed

Lines changed: 61 additions & 30 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

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

7+
* Feature/Label_Styles/0.1.3
8+
9+
+ Added scroll view to `PlanetViewController`
10+
+ Matched inspection border to Figma
11+
712
* Feature/Label_Styles/0.1.2
813

914
+ UI from design specs (label styles, assets, stack)

UILabel_Typography_Extensions/Extensions/UIKit+Extensions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ extension UIView {
4646
with {
4747
$0.layer.borderWidth = 1
4848
$0.layer.cornerRadius = 2
49-
$0.layer.borderColor = UIColor.red.withAlphaComponent(0.3).cgColor
50-
// $0.backgroundColor = UIColor.red.withAlphaComponent(0.1)
49+
$0.layer.borderColor = UIColor.red.withAlphaComponent(0.6).cgColor
50+
$0.backgroundColor = UIColor.red.withAlphaComponent(0.2)
5151
}
5252
}
5353

UILabel_Typography_Extensions/Menu/MenuViewController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ class MenuViewController: UIViewController {
8484

8585
override func viewDidAppear(_ animated: Bool) {
8686
super.viewDidAppear(animated)
87-
self.present(PlanetViewController(), animated: true)
87+
88+
self.present(PlanetViewController().with {
89+
$0.modalPresentationStyle = .fullScreen
90+
}, animated: true)
8891
}
8992
}
9093

UILabel_Typography_Extensions/Menu/Planet/PlanetViewController.swift

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,57 @@ import SwiftUI
1111

1212
class PlanetViewController: UIViewController {
1313

14-
lazy var heroLabel = UILabel().withHeroStyle
15-
lazy var subtitleLabel = UILabel().withSubtitleStyle
16-
lazy var image = UIImageView()
17-
lazy var introLabel = UILabel().withIntroStyle
18-
lazy var titleLabel = UILabel().withTitleStyle
19-
lazy var paragraphLabel = UILabel().withParagraphStyle
14+
lazy var heroLabel = UILabel().withHeroStyle.inspect
15+
lazy var subtitleLabel = UILabel().withSubtitleStyle.inspect
16+
lazy var image = UIImageView().inspect
17+
lazy var introLabel = UILabel().withIntroStyle.inspect
18+
lazy var titleLabel = UILabel().withTitleStyle.inspect
19+
lazy var paragraphLabel = UILabel().withParagraphStyle.inspect
2020

21-
lazy var body = UIStackView()
22-
.vertical(spacing: 5)
21+
lazy var stackView = UIStackView()
22+
.vertical(spacing: UI.StackView.spacing)
2323
.views(
24-
heroLabel
25-
.inspect,
26-
subtitleLabel
27-
.inspect,
28-
image
29-
.inspect,
30-
introLabel
31-
.inspect,
32-
titleLabel
33-
.inspect,
24+
heroLabel,
25+
subtitleLabel,
26+
image,
27+
introLabel,
28+
titleLabel,
3429
paragraphLabel
35-
.inspect,
36-
UIView
37-
.spacer
38-
.inspect
3930
)
4031
.with {
41-
$0.setCustomSpacing(25, after: introLabel)
42-
$0.setCustomSpacing(25, after: titleLabel)
32+
$0.setCustomSpacing(20 + 2 * UI.StackView.spacing, after: introLabel)
33+
$0.setCustomSpacing(20 + 2 * UI.StackView.spacing, after: titleLabel)
34+
}
35+
36+
lazy var scrollView = UIScrollView()
37+
.with {
38+
$0.clipsToBounds = false
4339
}
4440

4541
override func viewDidLoad() {
4642
super.viewDidLoad()
47-
view.addSubview(body)
43+
44+
// Colors.
4845
view.backgroundColor = .background
4946
overrideUserInterfaceStyle = .dark
50-
body.pin(
47+
48+
// Hierarchy.
49+
view.addSubview(scrollView)
50+
scrollView.addSubview(stackView)
51+
scrollView.pin(
5152
to: view.safeAreaLayoutGuide,
52-
insets: UIEdgeInsets(top: 25, left: 25, bottom: 25, right: 25)
53+
insets: .zero
54+
)
55+
stackView.pin(
56+
to: scrollView,
57+
insets: UI.padding
5358
)
59+
60+
// Vertical scrolling.
61+
stackView.widthAnchor.constraint(
62+
equalTo: scrollView.widthAnchor,
63+
constant: -UI.padding.left - UI.padding.right
64+
).isActive = true
5465
}
5566

5667
override func viewWillAppear(_ animated: Bool) {

UILabel_Typography_Extensions/Menu/Planet/Styles.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ import Foundation
99
import UIKit
1010

1111

12+
struct UI {
13+
14+
static let padding = UIEdgeInsets(top: 25, left: 25, bottom: 25, right: 25)
15+
16+
struct StackView {
17+
18+
static let spacing = CGFloat(5)
19+
static let spacer = CGFloat(20)
20+
}
21+
}
22+
23+
1224
extension UIColor {
1325

1426
static let background = UIColor(named: "Background") ?? UIColor.clear

0 commit comments

Comments
 (0)