Skip to content

Commit dcef389

Browse files
authored
Updates for 0.4.0 (#119)
* Updates for 0.4.0 * Depend on client 0.4.0-rc.0
1 parent f8ce490 commit dcef389

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ let package = Package(
1313
targets: ["LiveViewNativeCharts"]),
1414
],
1515
dependencies: [
16-
.package(url: "https://github.com/liveview-native/liveview-client-swiftui", from: "0.3.0")
16+
.package(url: "https://github.com/liveview-native/liveview-client-swiftui", from: "0.4.0-rc.0")
1717
],
1818
targets: [
1919
// Targets are the basic building blocks of a package, defining a module or a test suite.

Sources/LiveViewNativeCharts/AxisContent/AxisMarks.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ struct AxisMarks<R: RootRegistry>: ComposedAxisContent {
7070
let element: ElementNode
7171
let context: AxisContentBuilder.Context<R>
7272

73+
@MainActor
7374
var body: some AxisContent {
7475
let preset = (try? element.attributeValue(AxisMarkPreset.self, for: "preset")) ?? .automatic
7576
let position = (try? element.attributeValue(AxisMarkPosition.self, for: "position")) ?? .automatic
@@ -138,15 +139,15 @@ struct AxisMarks<R: RootRegistry>: ComposedAxisContent {
138139
let children = element.children()
139140
let values = children
140141
.compactMap {
141-
try? $0.attributes
142+
try? $0.attributes()
142143
.first(where: { $0.name == "value" })
143144
.map({ try Double.init(from: $0, on: element) })
144145
}
145146
Charts.AxisMarks(preset: preset, position: position, values: values) { (value: Charts.AxisValue) in
146147
AnyAxisMark(
147148
try! AxisContentBuilder.build(
148149
children.filter({
149-
(try? $0.attributes
150+
(try? $0.attributes()
150151
.first(where: { $0.name == "value" })
151152
.map({ try Double.init(from: $0, on: element) })
152153
)

Sources/LiveViewNativeCharts/AxisMark/AxisMarkBuilder.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ struct AxisMarkBuilder: ContentBuilder {
7979
}
8080
}
8181

82+
@MainActor
8283
protocol ComposedAxisMark {
8384
associatedtype Body: AxisMark
8485
@Charts.AxisMarkBuilder

Sources/LiveViewNativeCharts/AxisMark/AxisValue.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import LiveViewNative
2929
#if swift(>=5.8)
3030
@_documentation(visibility: public)
3131
#endif
32+
@MainActor
3233
struct AxisValue<R: RootRegistry>: ComposedAxisMark {
3334
let element: ElementNode
3435
let context: AxisMarkBuilder.Context<R>

Sources/LiveViewNativeCharts/AxisMark/AxisValueLabel.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import LiveViewNativeCore
3737
#if swift(>=5.8)
3838
@_documentation(visibility: public)
3939
#endif
40+
@MainActor
4041
struct AxisValueLabel<R: RootRegistry>: ComposedAxisMark {
4142
let element: ElementNode
4243
let context: AxisMarkBuilder.Context<R>
@@ -136,6 +137,10 @@ struct AxisValueLabel<R: RootRegistry>: ComposedAxisMark {
136137
fatalError("Unknown format '\(format)'")
137138
}
138139
} else {
140+
let childViews = AxisMarkBuilder.buildChildViews(
141+
of: element,
142+
in: context
143+
)
139144
Charts.AxisValueLabel(
140145
centered: centered,
141146
anchor: anchor,
@@ -146,10 +151,7 @@ struct AxisValueLabel<R: RootRegistry>: ComposedAxisMark {
146151
horizontalSpacing: horizontalSpacing,
147152
verticalSpacing: verticalSpacing
148153
) {
149-
AxisMarkBuilder.buildChildViews(
150-
of: element,
151-
in: context
152-
)
154+
childViews
153155
}
154156
}
155157
}

0 commit comments

Comments
 (0)