Skip to content

Commit da0eeae

Browse files
committed
Fix build in older Xcode versions
1 parent 867ba8e commit da0eeae

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Sources/LiveViewNativeCharts/AxisContent/AxisMarks.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,9 @@ extension Calendar.Component: AttributeDecodable {
371371
case "nanosecond": self = .nanosecond
372372
case "calendar": self = .calendar
373373
case "time_zone": self = .timeZone
374+
#if swift(>=5.9)
374375
case "is_leap_month": self = .isLeapMonth
376+
#endif
375377
default: throw AttributeDecodingError.badValue(Self.self)
376378
}
377379
}

Sources/LiveViewNativeCharts/Modifiers/AnnotationModifier.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ struct AnnotationModifier: ContentModifier {
7979
let overflowResolution = overflowResolution?.value
8080
{
8181
#if swift(>=5.9)
82-
content
82+
return content
8383
.annotation(
8484
position: position,
8585
alignment: alignment,
@@ -88,9 +88,12 @@ struct AnnotationModifier: ContentModifier {
8888
) {
8989
Builder.buildChildViews(of: element, forTemplate: self.content, in: context)
9090
}
91+
#else
92+
let _ = overflowResolution
93+
return content
9194
#endif
9295
} else {
93-
content
96+
return content
9497
.annotation(
9598
position: position,
9699
alignment: alignment,
@@ -126,6 +129,7 @@ struct OverflowResolution: Decodable {
126129
#endif
127130

128131
init(from decoder: Decoder) throws {
132+
#if swift(>=5.9)
129133
var container = try decoder.unkeyedContainer()
130134
if #available(iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0, *) {
131135
let x = try container.decode(AnnotationOverflowResolution.Strategy.self)
@@ -134,6 +138,9 @@ struct OverflowResolution: Decodable {
134138
} else {
135139
throw DecodingError.dataCorrupted(.init(codingPath: container.codingPath, debugDescription: "AnnotationOverflowResolution is only available on iOS 17, macOS 14, tvOS 17, and watchOS 10 or higher."))
136140
}
141+
#else
142+
fatalError()
143+
#endif
137144
}
138145
}
139146

0 commit comments

Comments
 (0)