Skip to content

Commit 1b38fc1

Browse files
committed
apply macro in components and example
1 parent 6132381 commit 1b38fc1

File tree

14 files changed

+73
-102
lines changed

14 files changed

+73
-102
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
/// Base view to implement label within cell
1213
public class LabelView: UIView {
@@ -23,6 +24,7 @@ extension LabelView: ConfigurableItem {
2324

2425
// MARK: - Model
2526

27+
@Mutable
2628
public struct Model: AlignmentProvider {
2729

2830
// MARK: - Editor
@@ -89,28 +91,6 @@ extension LabelView: ConfigurableItem {
8991
private(set) public var alignment: Alignment = .all(.zero)
9092
private(set) public var textAlignment: NSTextAlignment = .left
9193

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

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

Components/Sources/Common/Views/MessageView.swift

Lines changed: 7 additions & 47 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
/// Base view to implement label within cell
1213
public class MessageView: UIView {
@@ -24,6 +25,7 @@ extension MessageView: ConfigurableItem {
2425

2526
// MARK: - Model
2627

28+
@Mutable
2729
public struct Model: Equatable, AlignmentProvider {
2830

2931
// MARK: - Editor
@@ -52,15 +54,15 @@ extension MessageView: ConfigurableItem {
5254
public static func style(_ value: TextStyle) -> Property {
5355
.init(closure: { model in
5456
var model = model
55-
model.set(style: value)
57+
model.set(textStyle: value)
5658
return model
5759
})
5860
}
5961

6062
public static func layout(_ value: TextLayout) -> Property {
6163
.init(closure: { model in
6264
var model = model
63-
model.set(layout: value)
65+
model.set(textLayout: value)
6466
return model
6567
})
6668
}
@@ -84,23 +86,23 @@ extension MessageView: ConfigurableItem {
8486
public static func insets(_ value: UIEdgeInsets) -> Property {
8587
.init(closure: { model in
8688
var model = model
87-
model.set(insets: value)
89+
model.set(internalEdgeInsets: value)
8890
return model
8991
})
9092
}
9193

9294
public static func background(_ value: BackgroundStyle) -> Property {
9395
.init(closure: { model in
9496
var model = model
95-
model.set(background: value)
97+
model.set(backgroundStyle: value)
9698
return model
9799
})
98100
}
99101

100102
public static func border(_ value: BorderStyle) -> Property {
101103
.init(closure: { model in
102104
var model = model
103-
model.set(border: value)
105+
model.set(borderStyle: value)
104106
return model
105107
})
106108
}
@@ -136,48 +138,6 @@ extension MessageView: ConfigurableItem {
136138
private(set) public var dataDetection: DataDetectionStyle?
137139
private(set) public var selectable: Bool = false
138140

139-
// MARK: - Mutation
140-
141-
mutating func set(text: TextValue) {
142-
self.text = text
143-
}
144-
145-
mutating func set(style: TextStyle) {
146-
self.textStyle = style
147-
}
148-
149-
mutating func set(layout: TextLayout) {
150-
self.textLayout = layout
151-
}
152-
153-
mutating func set(alignment: Alignment) {
154-
self.alignment = alignment
155-
}
156-
157-
mutating func set(textAlignment: NSTextAlignment) {
158-
self.textAlignment = textAlignment
159-
}
160-
161-
mutating func set(insets: UIEdgeInsets) {
162-
self.internalEdgeInsets = insets
163-
}
164-
165-
mutating func set(background: BackgroundStyle) {
166-
self.backgroundStyle = background
167-
}
168-
169-
mutating func set(border: BorderStyle) {
170-
self.borderStyle = border
171-
}
172-
173-
mutating func set(dataDetection: DataDetectionStyle) {
174-
self.dataDetection = dataDetection
175-
}
176-
177-
mutating func set(selectable: Bool) {
178-
self.selectable = selectable
179-
}
180-
181141
// MARK: - Builder
182142

183143
public static func build(@EditorBuilder<Property> content: (Property.Type) -> [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)