Skip to content

Commit 3232144

Browse files
committed
apply macro in components and example
1 parent 969322e commit 3232144

File tree

14 files changed

+73
-94
lines changed

14 files changed

+73
-94
lines changed

Brewfile.lock.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"entries": {
33
"tap": {
44
"homebrew/cask": {
5-
"revision": "266747f8b172dd47e6c80ce2590889a8a7c96501"
5+
"revision": "c896fe86403b4515fddc15421cce660a306dc3f0"
66
},
77
"yonaskolb/xcodegen": {
88
"revision": "372f20fe5a3823dc398f52cb6cc1af5003d452f7",
@@ -19,7 +19,7 @@
1919
},
2020
"brew": {
2121
"xcodegen": {
22-
"version": "2.25.0",
22+
"version": "2.35.0",
2323
"bottle": {
2424
"rebuild": 0,
2525
"root_url": "https://ghcr.io/v2/homebrew/core",
@@ -58,7 +58,7 @@
5858
}
5959
},
6060
"sourcery": {
61-
"version": "1.8.1",
61+
"version": "2.0.2",
6262
"bottle": {
6363
"rebuild": 0,
6464
"root_url": "https://ghcr.io/v2/homebrew/core",
@@ -107,11 +107,11 @@
107107
"macOS": "11.5.1"
108108
},
109109
"ventura": {
110-
"HOMEBREW_VERSION": "4.0.19",
111-
"HOMEBREW_PREFIX": "/opt/homebrew",
110+
"HOMEBREW_VERSION": "4.0.23-10-g6abf680",
111+
"HOMEBREW_PREFIX": "/usr/local",
112112
"Homebrew/homebrew-core": "api",
113113
"CLT": "",
114-
"Xcode": "14.3",
114+
"Xcode": "15.0",
115115
"macOS": "13.4"
116116
}
117117
}

Components/Macro/Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ let package = Package(
1111
// Products define the executables and libraries a package produces, making them visible to other packages.
1212
.library(
1313
name: "Macro",
14+
type: .dynamic,
1415
targets: ["Macro"]
1516
),
1617
.executable(

Components/Package.resolved

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Components/Package.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1-
// swift-tools-version:5.3
1+
// swift-tools-version:5.9
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

66
let package = Package(
77
name: "ReactiveDataComponents",
8-
platforms: [.iOS(.v11)],
8+
platforms: [.iOS(.v13)],
99
products: [
1010
.library(
1111
name: "ReactiveDataComponents",
1212
targets: ["ReactiveDataComponents"]
1313
)
1414
],
1515
dependencies: [
16-
.package(name: "ReactiveDataDisplayManager", path: "../")
16+
.package(name: "ReactiveDataDisplayManager", path: "../"),
17+
.package(name: "Macro", path: "./Macro")
1718
],
1819
targets: [
1920
.target(
2021
name: "ReactiveDataComponents",
21-
dependencies: ["ReactiveDataDisplayManager"],
22+
dependencies: ["ReactiveDataDisplayManager", "Macro"],
2223
path: "Sources"
2324
)
2425
]

Components/Sources/Common/Views/LabelView.swift

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import UIKit
99
import ReactiveDataDisplayManager
10+
import Macro
1011

1112
public typealias LabelProperty = LabelView.Model.Property
1213

@@ -25,6 +26,7 @@ extension LabelView: ConfigurableItem {
2526

2627
// MARK: - Model
2728

29+
@Mutable
2830
public struct Model: AlignmentProvider {
2931

3032
// MARK: - Editor
@@ -91,28 +93,6 @@ extension LabelView: ConfigurableItem {
9193
private(set) public var alignment: Alignment = .all(.zero)
9294
private(set) public var textAlignment: NSTextAlignment = .left
9395

94-
// MARK: - Mutation
95-
96-
mutating func set(text: TextValue) {
97-
self.text = text
98-
}
99-
100-
mutating func set(style: TextStyle) {
101-
self.style = style
102-
}
103-
104-
mutating func set(layout: TextLayout) {
105-
self.layout = layout
106-
}
107-
108-
mutating func set(alignment: Alignment) {
109-
self.alignment = alignment
110-
}
111-
112-
mutating func set(textAlignment: NSTextAlignment) {
113-
self.textAlignment = textAlignment
114-
}
115-
11696
// MARK: - Builder
11797

11898
public static func build(@EditorBuilder<Property> content: () -> [Property]) -> Self {

Components/Sources/Common/Views/MessageView.swift

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#if os(iOS)
88
import UIKit
99
import ReactiveDataDisplayManager
10+
import Macro
1011

1112
public typealias MessageProperty = MessageView.Model.Property
1213

@@ -25,6 +26,7 @@ extension MessageView: ConfigurableItem {
2526

2627
// MARK: - Model
2728

29+
@Mutable
2830
public struct Model: Equatable, AlignmentProvider {
2931

3032
// MARK: - Editor
@@ -53,15 +55,15 @@ extension MessageView: ConfigurableItem {
5355
public static func style(_ value: TextStyle) -> Property {
5456
.init(closure: { model in
5557
var model = model
56-
model.set(style: value)
58+
model.set(textStyle: value)
5759
return model
5860
})
5961
}
6062

6163
public static func layout(_ value: TextLayout) -> Property {
6264
.init(closure: { model in
6365
var model = model
64-
model.set(layout: value)
66+
model.set(textLayout: value)
6567
return model
6668
})
6769
}
@@ -85,23 +87,23 @@ extension MessageView: ConfigurableItem {
8587
public static func insets(_ value: UIEdgeInsets) -> Property {
8688
.init(closure: { model in
8789
var model = model
88-
model.set(insets: value)
90+
model.set(internalEdgeInsets: value)
8991
return model
9092
})
9193
}
9294

9395
public static func background(_ value: BackgroundStyle) -> Property {
9496
.init(closure: { model in
9597
var model = model
96-
model.set(background: value)
98+
model.set(backgroundStyle: value)
9799
return model
98100
})
99101
}
100102

101103
public static func border(_ value: BorderStyle) -> Property {
102104
.init(closure: { model in
103105
var model = model
104-
model.set(border: value)
106+
model.set(borderStyle: value)
105107
return model
106108
})
107109
}
@@ -118,40 +120,6 @@ extension MessageView: ConfigurableItem {
118120
private(set) public var internalEdgeInsets: UIEdgeInsets = .zero
119121
private(set) public var borderStyle: BorderStyle?
120122

121-
// MARK: - Mutation
122-
123-
mutating func set(text: TextValue) {
124-
self.text = text
125-
}
126-
127-
mutating func set(style: TextStyle) {
128-
self.textStyle = style
129-
}
130-
131-
mutating func set(layout: TextLayout) {
132-
self.textLayout = layout
133-
}
134-
135-
mutating func set(alignment: Alignment) {
136-
self.alignment = alignment
137-
}
138-
139-
mutating func set(textAlignment: NSTextAlignment) {
140-
self.textAlignment = textAlignment
141-
}
142-
143-
mutating func set(insets: UIEdgeInsets) {
144-
self.internalEdgeInsets = insets
145-
}
146-
147-
mutating func set(background: BackgroundStyle) {
148-
self.backgroundStyle = background
149-
}
150-
151-
mutating func set(border: BorderStyle) {
152-
self.borderStyle = border
153-
}
154-
155123
// MARK: - Builder
156124

157125
public static func build(@EditorBuilder<Property> content: () -> [Property]) -> Self {

Components/project.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22
name: ReactiveDataComponents
33
options:
44
# Версия Xcode
5-
xcodeVersion: 13.4.1
5+
xcodeVersion: 15.0.0
66
# Создание пустых директорий
77
generateEmptyDirectories: true
88
# Создание групп
99
createIntermediateGroups: true
10+
1011
targets:
1112
ReactiveDataComponents:
1213
dependencies:
1314
- sdk: UIKit.framework
1415
type: framework
1516
platform: [iOS, tvOS]
1617
deploymentTarget:
17-
iOS: 11.0
18-
tvOS: 11.0
18+
iOS: 13.0
19+
tvOS: 13.0
1920
scheme:
2021
configVariants: all
2122
testTargets:
@@ -24,7 +25,9 @@ targets:
2425
sources:
2526
- path: Sources
2627
dependencies:
28+
- package: Macro
2729
- target: ReactiveDataDisplayManager_${platform}
30+
2831
info:
2932
path: Info.plist
3033
properties:
@@ -47,8 +50,8 @@ targets:
4750
type: bundle.unit-test
4851
platform: [iOS, tvOS]
4952
deploymentTarget:
50-
iOS: 11.0
51-
tvOS: 11.0
53+
iOS: 13.0
54+
tvOS: 13.0
5255
scheme:
5356
configVariants: all
5457
sources:

Example/project.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,14 @@ include:
88
name: ReactiveDataDisplayManagerExample
99
options:
1010
# Версия Xcode
11-
xcodeVersion: 13.4.1
11+
xcodeVersion: 15.0.0
1212
# Создание пустых директорий
1313
generateEmptyDirectories: true
1414
# Создание групп
1515
createIntermediateGroups: true
1616
settings:
1717
DEVELOPMENT_TEAM: EFAAG9GXN4
1818

19-
packages:
20-
Vapor:
21-
github: vapor/vapor
22-
from: 4.0.0
23-
2419
targets:
2520

2621
ReactiveServer_macOS:
@@ -61,12 +56,12 @@ targets:
6156

6257
ReactiveDataDisplayManagerExample_iOS:
6358
platform: iOS
64-
deploymentTarget: 11.0
59+
deploymentTarget: 13.0
6560
scheme:
6661
configVariants: all
6762
testTargets:
6863
- ReactiveDataDisplayManagerExampleUITests
69-
gatherCoverageData: true
64+
gatherCoverageData: false
7065
sources:
7166
- path: ReactiveDataDisplayManager
7267
dependencies:

Example/targets/template.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ targetTemplates:
2323
type: bundle.ui-testing
2424
platform: iOS
2525
deploymentTarget:
26-
iOS: 11.0
27-
tvOS: 10.0
26+
iOS: 13.0
27+
tvOS: 13.0
2828
scheme:
2929
configVariants: all
30-
gatherCoverageData: true
30+
gatherCoverageData: false
3131

3232
BaseSettings:
3333
settings:

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.3
1+
// swift-tools-version:5.9
22
import PackageDescription
33

44
let package = Package(

0 commit comments

Comments
 (0)