Skip to content

Commit 2c6730c

Browse files
committed
Require Swift 6; add LMViewBuilder.
1 parent 69cb50f commit 2c6730c

19 files changed

+209
-179
lines changed

LimaTest.xcodeproj/project.pbxproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@
229229
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
230230
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
231231
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
232+
IPHONEOS_DEPLOYMENT_TARGET = 18.6;
232233
LD_RUNPATH_SEARCH_PATHS = (
233234
"$(inherited)",
234235
"@executable_path/Frameworks",
@@ -237,7 +238,7 @@
237238
PRODUCT_BUNDLE_IDENTIFIER = org.httprpc.LimaTest;
238239
PRODUCT_NAME = "$(TARGET_NAME)";
239240
SWIFT_EMIT_LOC_STRINGS = YES;
240-
SWIFT_VERSION = 5.0;
241+
SWIFT_VERSION = 6.0;
241242
TARGETED_DEVICE_FAMILY = "1,2";
242243
};
243244
name = Debug;
@@ -255,6 +256,7 @@
255256
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
256257
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
257258
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
259+
IPHONEOS_DEPLOYMENT_TARGET = 18.6;
258260
LD_RUNPATH_SEARCH_PATHS = (
259261
"$(inherited)",
260262
"@executable_path/Frameworks",
@@ -263,7 +265,7 @@
263265
PRODUCT_BUNDLE_IDENTIFIER = org.httprpc.LimaTest;
264266
PRODUCT_NAME = "$(TARGET_NAME)";
265267
SWIFT_EMIT_LOC_STRINGS = YES;
266-
SWIFT_VERSION = 5.0;
268+
SWIFT_VERSION = 6.0;
267269
TARGETED_DEVICE_FAMILY = "1,2";
268270
};
269271
name = Release;

LimaTest/ActionViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ class ActionViewController: UIViewController {
1919
var greetingLabel: UILabel!
2020

2121
override func loadView() {
22-
view = LMColumnView(horizontalAlignment: .center, verticalAlignment: .top, backgroundColor: .white,
22+
view = LMColumnView(horizontalAlignment: .center, verticalAlignment: .top, backgroundColor: .white) {
2323
UIButton(configuration: .tinted(), primaryAction: UIAction(title: "Say Hello") { [unowned self] _ in
2424
sayHello()
25-
}),
25+
})
2626

2727
UILabel(textAlignment: .center) {
2828
greetingLabel = $0
2929
}
30-
)
30+
}
3131
}
3232

3333
func sayHello() {

LimaTest/AnchorViewController.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@ class AnchorViewController: UIViewController {
2222
cell.layer.borderColor = UIColor.lightGray.cgColor
2323
}
2424

25-
view = LMAnchorView(margin: 16, backgroundColor: .white,
25+
view = LMAnchorView(margin: 16, backgroundColor: .white) {
2626
// All
27-
UILabel(anchor: [.all], with: cellStyle),
27+
UILabel(anchor: [.all], with: cellStyle)
2828

2929
// Top
30-
UILabel(text: "Top Leading", anchor: [.top, .leading], with: cellStyle),
31-
UILabel(text: "Top", anchor: [.top], with: cellStyle),
32-
UILabel(text: "Top Trailing", anchor: [.top, .trailing], with: cellStyle),
30+
UILabel(text: "Top Leading", anchor: [.top, .leading], with: cellStyle)
31+
UILabel(text: "Top", anchor: [.top], with: cellStyle)
32+
UILabel(text: "Top Trailing", anchor: [.top, .trailing], with: cellStyle)
3333

3434
// Middle
35-
UILabel(text: "Leading", anchor: [.leading], with: cellStyle),
36-
UILabel(text: "None", anchor: [], with: cellStyle),
37-
UILabel(text: "Trailing", anchor: [.trailing], with: cellStyle),
35+
UILabel(text: "Leading", anchor: [.leading], with: cellStyle)
36+
UILabel(text: "None", anchor: [], with: cellStyle)
37+
UILabel(text: "Trailing", anchor: [.trailing], with: cellStyle)
3838

3939
// Bottom
40-
UILabel(text: "Bottom Leading", anchor: [.bottom, .leading], with: cellStyle),
41-
UILabel(text: "Bottom", anchor: [.bottom], with: cellStyle),
40+
UILabel(text: "Bottom Leading", anchor: [.bottom, .leading], with: cellStyle)
41+
UILabel(text: "Bottom", anchor: [.bottom], with: cellStyle)
4242
UILabel(text: "Bottom Trailing", anchor: [.bottom, .trailing], with: cellStyle)
43-
)
43+
}
4444
}
4545
}

LimaTest/BaselineAlignmentViewController.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ import Lima
1717

1818
class BaselineAlignmentViewController: UIViewController {
1919
override func loadView() {
20-
view = LMColumnView(margin: 8, verticalAlignment: .top, backgroundColor: .white,
21-
LMRowView(spacing: 4, isAlignToBaseline: true,
22-
LMSpacer(),
23-
UILabel(text: "abcd", font: .systemFont(ofSize: 12)),
24-
UILabel(text: "efg", font: .boldSystemFont(ofSize: 48)),
25-
UILabel(text: "hijk", font: .systemFont(ofSize: 24)),
20+
view = LMColumnView(margin: 8, verticalAlignment: .top, backgroundColor: .white) {
21+
LMRowView(spacing: 4, isAlignToBaseline: true) {
2622
LMSpacer()
27-
)
28-
)
23+
UILabel(text: "abcd", font: .systemFont(ofSize: 12))
24+
UILabel(text: "efg", font: .boldSystemFont(ofSize: 48))
25+
UILabel(text: "hijk", font: .systemFont(ofSize: 24))
26+
LMSpacer()
27+
}
28+
}
2929
}
3030
}

LimaTest/ControlsViewController.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,22 @@ class ControlsViewController: UITableViewController {
109109
]),
110110

111111
Section(headerView: LMTableViewHeaderFooterView(
112-
LMRowView(
113-
UILabel(text: "Custom Header", textColor: .gray, font: .preferredFont(forTextStyle: .headline)),
114-
LMSpacer(),
112+
LMRowView() {
113+
UILabel(text: "Custom Header", textColor: .gray, font: .preferredFont(forTextStyle: .headline))
114+
LMSpacer()
115115
UIImageView(image: UIImage(systemName: "questionmark.circle"), contentMode: .center, tintColor: .gray)
116-
)
116+
}
117117
), cells: [
118118
LMTableViewCell(
119-
LMRowView(
120-
LMSpacer(),
119+
LMRowView() {
120+
LMSpacer()
121121
UIStepper(primaryAction: UIAction() { [unowned self] action in
122122
stepperValueChanged()
123123
}, minimumValue: 0.0, maximumValue: 1.0, stepValue: 0.1) {
124124
stepper = $0
125-
},
125+
}
126126
LMSpacer()
127-
)
127+
}
128128
),
129129
LMTableViewCell(
130130
UISlider(primaryAction: UIAction() { [unowned self] action in
@@ -142,11 +142,11 @@ class ControlsViewController: UITableViewController {
142142
}
143143
),
144144
LMTableViewCell(
145-
LMColumnView(topMargin: 8, bottomMargin: 8,
145+
LMColumnView(topMargin: 8, bottomMargin: 8) {
146146
UIProgressView() {
147147
progressView = $0
148148
}
149-
)
149+
}
150150
)
151151
])
152152
]

LimaTest/GreetingViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import Lima
1717

1818
class GreetingViewController: UIViewController {
1919
override func loadView() {
20-
let columnView = LMColumnView(
21-
UIImageView(image: UIImage(named: "world.png"), contentMode: .scaleAspectFit),
20+
let columnView = LMColumnView() {
21+
UIImageView(image: UIImage(named: "world.png"), contentMode: .scaleAspectFit)
2222
UILabel(text: "Hello, World!", textAlignment: .center)
23-
)
23+
}
2424

2525
view = LMScrollView(isFitToWidth: true,
2626
backgroundColor: .white,

LimaTest/GridAlignmentViewController.swift

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,41 +25,41 @@ class GridAlignmentViewController: UIViewController {
2525
let text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
2626

2727
view = LMScrollView(isFitToWidth: true, backgroundColor: .white,
28-
LMColumnView(margin: 16,
28+
LMColumnView(margin: 16) {
2929
// Fill
30-
UILabel(text: text, numberOfLines: 0, with: cellStyle),
30+
UILabel(text: text, numberOfLines: 0, with: cellStyle)
3131

3232
// Baselines
33-
LMColumnView(isAlignToGrid: true,
34-
LMRowView(isAlignToBaseline: true,
35-
UILabel(text: "First Baseline", textAlignment: .right, with: cellStyle),
33+
LMColumnView(isAlignToGrid: true) {
34+
LMRowView(isAlignToBaseline: true) {
35+
UILabel(text: "First Baseline", textAlignment: .right, with: cellStyle)
3636

37-
LMColumnView(weight: 1, with: cellStyle,
38-
UILabel(text: text, numberOfLines: 0),
37+
LMColumnView(weight: 1, with: cellStyle) {
3938
UILabel(text: text, numberOfLines: 0)
40-
)
41-
),
39+
UILabel(text: text, numberOfLines: 0)
40+
}
41+
}
4242

43-
LMRowView(isAlignToBaseline: true, baseline: .last,
44-
UILabel(text: "Last Baseline", textAlignment: .right, with: cellStyle),
43+
LMRowView(isAlignToBaseline: true, baseline: .last) {
44+
UILabel(text: "Last Baseline", textAlignment: .right, with: cellStyle)
4545

46-
LMColumnView(weight: 1, with: cellStyle,
47-
UILabel(text: text, numberOfLines: 0),
46+
LMColumnView(weight: 1, with: cellStyle) {
47+
UILabel(text: text, numberOfLines: 0)
4848
UILabel(text: text, numberOfLines: 0)
49-
)
50-
)
51-
),
49+
}
50+
}
51+
}
5252

5353
// Weights
54-
LMRowView(
55-
LMColumnView(weight: 2, with: cellStyle,
56-
UILabel(text: text, numberOfLines: 0),
54+
LMRowView() {
55+
LMColumnView(weight: 2, with: cellStyle) {
56+
UILabel(text: text, numberOfLines: 0)
5757
LMSpacer()
58-
),
58+
}
5959

6060
UILabel(text: text, numberOfLines: 0, weight: 1, with: cellStyle)
61-
)
62-
)
61+
}
62+
}
6363
)
6464
}
6565
}

LimaTest/HitTestViewController.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,32 @@ import Lima
1717

1818
class HitTestViewController: UIViewController {
1919
override func loadView() {
20-
view = LMAnchorView(backgroundColor: .white,
21-
UIButton(configuration: .tinted(), primaryAction: UIAction() { _ in }, anchor: [.all]),
20+
view = LMAnchorView(backgroundColor: .white) {
21+
UIButton(configuration: .tinted(), primaryAction: UIAction() { _ in }, anchor: [.all])
2222

23-
LMColumnView(anchor: [.all],
24-
LMRowView(weight: 1,
23+
LMColumnView(anchor: [.all]) {
24+
LMRowView(weight: 1) {
2525
UILabel(text: "Transparent Row View", textAlignment: .center)
26-
),
27-
LMRowView(backgroundColor: UIColor(0xffffff, alpha: 0.5), weight: 1,
26+
}
27+
LMRowView(backgroundColor: UIColor(0xffffff, alpha: 0.5), weight: 1) {
2828
UILabel(text: "Opaque Row View", textAlignment: .center)
29-
),
30-
LMAnchorView(weight: 1,
29+
}
30+
LMAnchorView(weight: 1) {
3131
LMSpacer() { spacer in
3232
spacer.anchor = [.all]
33-
},
33+
}
3434

3535
UILabel(text: "Transparent Spacer")
36-
),
37-
LMAnchorView(weight: 1,
36+
}
37+
LMAnchorView(weight: 1) {
3838
LMSpacer(backgroundColor: UIColor(0xffffff, alpha: 0.5)) { spacer in
3939
spacer.anchor = [.all]
40-
},
40+
}
4141

4242
UILabel(text: "Opaque Spacer")
43-
)
44-
)
45-
)
43+
}
44+
}
45+
}
4646
}
4747
}
4848

LimaTest/HorizontalAlignmentViewController.swift

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -27,61 +27,61 @@ class HorizontalAlignmentViewController: UIViewController {
2727
}
2828

2929
view = LMScrollView(isFitToWidth: true, backgroundColor: .white,
30-
LMColumnView(margin: 8,
30+
LMColumnView(margin: 8) {
3131
// Leading alignment
32-
UILabel(text: "Leading", font: .systemFont(ofSize: 14)),
32+
UILabel(text: "Leading", font: .systemFont(ofSize: 14))
3333

34-
LMRowView(margin: 8, horizontalAlignment: .leading, with: cellStyle,
35-
UIImageView(image: phoneIcon, tintColor: .black),
36-
UIImageView(image: faxIcon, tintColor: .black),
34+
LMRowView(margin: 8, horizontalAlignment: .leading, with: cellStyle) {
35+
UIImageView(image: phoneIcon, tintColor: .black)
36+
UIImageView(image: faxIcon, tintColor: .black)
3737
UIImageView(image: emailIcon, tintColor: .black)
38-
),
38+
}
3939

40-
LMColumnView(margin: 8, horizontalAlignment: .leading, with: cellStyle,
41-
UIImageView(image: phoneIcon, tintColor: .black),
42-
UIImageView(image: faxIcon, tintColor: .black),
40+
LMColumnView(margin: 8, horizontalAlignment: .leading, with: cellStyle) {
41+
UIImageView(image: phoneIcon, tintColor: .black)
42+
UIImageView(image: faxIcon, tintColor: .black)
4343
UIImageView(image: emailIcon, tintColor: .black)
44-
),
44+
}
4545

46-
LMSpacer(height: 0.5, backgroundColor: .gray),
46+
LMSpacer(height: 0.5, backgroundColor: .gray)
4747

4848
// Trailing alignment
49-
UILabel(text: "Trailing", font: .systemFont(ofSize: 14)),
49+
UILabel(text: "Trailing", font: .systemFont(ofSize: 14))
5050

51-
LMRowView(margin: 8, horizontalAlignment: .trailing, with: cellStyle,
52-
UIImageView(image: phoneIcon, tintColor: .black),
53-
UIImageView(image: faxIcon, tintColor: .black),
51+
LMRowView(margin: 8, horizontalAlignment: .trailing, with: cellStyle) {
52+
UIImageView(image: phoneIcon, tintColor: .black)
53+
UIImageView(image: faxIcon, tintColor: .black)
5454
UIImageView(image: emailIcon, tintColor: .black)
55-
),
55+
}
5656

57-
LMColumnView(margin: 8, horizontalAlignment: .trailing, with: cellStyle,
58-
UIImageView(image: phoneIcon, tintColor: .black),
59-
UIImageView(image: faxIcon, tintColor: .black),
57+
LMColumnView(margin: 8, horizontalAlignment: .trailing, with: cellStyle) {
58+
UIImageView(image: phoneIcon, tintColor: .black)
59+
UIImageView(image: faxIcon, tintColor: .black)
6060
UIImageView(image: emailIcon, tintColor: .black)
61-
),
61+
}
6262

63-
LMSpacer(height: 0.5, backgroundColor: .gray),
63+
LMSpacer(height: 0.5, backgroundColor: .gray)
6464

6565
// Center alignment
66-
UILabel(text: "Center", font: .systemFont(ofSize: 14)),
66+
UILabel(text: "Center", font: .systemFont(ofSize: 14))
6767

68-
LMColumnView(margin: 8, horizontalAlignment: .center, with: cellStyle,
69-
UIImageView(image: phoneIcon, tintColor: .black),
70-
UIImageView(image: faxIcon, tintColor: .black),
68+
LMColumnView(margin: 8, horizontalAlignment: .center, with: cellStyle) {
69+
UIImageView(image: phoneIcon, tintColor: .black)
70+
UIImageView(image: faxIcon, tintColor: .black)
7171
UIImageView(image: emailIcon, tintColor: .black)
72-
),
72+
}
7373

74-
LMSpacer(height: 0.5, backgroundColor: .gray),
74+
LMSpacer(height: 0.5, backgroundColor: .gray)
7575

7676
// Fill alignment
77-
UILabel(text: "Fill", font: .systemFont(ofSize: 14)),
77+
UILabel(text: "Fill", font: .systemFont(ofSize: 14))
7878

79-
LMRowView(margin: 8, horizontalAlignment: .fill, with: cellStyle,
80-
UIImageView(image: phoneIcon, contentMode: .center, tintColor: .black, weight: 1),
81-
UIImageView(image: faxIcon, contentMode: .center, tintColor: .black, weight: 1),
79+
LMRowView(margin: 8, horizontalAlignment: .fill, with: cellStyle) {
80+
UIImageView(image: phoneIcon, contentMode: .center, tintColor: .black, weight: 1)
81+
UIImageView(image: faxIcon, contentMode: .center, tintColor: .black, weight: 1)
8282
UIImageView(image: emailIcon, contentMode: .center, tintColor: .black, weight: 1)
83-
)
84-
)
83+
}
84+
}
8585
)
8686
}
8787
}

0 commit comments

Comments
 (0)