Skip to content

Commit 3c8a4b8

Browse files
committed
Post-rebase fixes
1 parent 0d0a2a8 commit 3c8a4b8

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

Sources/SwiftCrossUI/Backend/AppBackend.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public protocol AppBackend: Sendable {
194194
/// A default implementation is provided. It uses the backend's reported
195195
/// device class and looks up the text style in a lookup table derived
196196
/// from Apple's typography guidelines. See ``TextStyle/resolve(for:)``.
197-
@Sendable func resolveTextStyle(_ textStyle: Font.TextStyle) -> Font.TextStyle.Resolved
197+
func resolveTextStyle(_ textStyle: Font.TextStyle) -> Font.TextStyle.Resolved
198198

199199
/// Computes a window's environment based off the root environment. This may involve
200200
/// updating ``EnvironmentValues/windowScaleFactor`` etc.
@@ -684,7 +684,6 @@ public protocol AppBackend: Sendable {
684684
}
685685

686686
extension AppBackend {
687-
@Sendable
688687
public func resolveTextStyle(
689688
_ textStyle: Font.TextStyle
690689
) -> Font.TextStyle.Resolved {

Sources/SwiftCrossUI/Environment/EnvironmentValues.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,19 @@ public struct EnvironmentValues {
2727
/// A font resolution context derived from the current environment.
2828
///
2929
/// Essentially just a subset of the environment.
30+
@MainActor
3031
public var fontResolutionContext: Font.Context {
3132
Font.Context(
3233
overlay: fontOverlay,
3334
deviceClass: backend.deviceClass,
34-
resolveTextStyle: backend.resolveTextStyle(_:)
35+
resolveTextStyle: { backend.resolveTextStyle($0) }
3536
)
3637
}
3738

3839
/// The current font resolved to a form suitable for rendering. Just a
3940
/// helper method for our own backends. We haven't made this public because
4041
/// it would be weird to have two pretty equivalent ways of resolving fonts.
42+
@MainActor
4143
package var resolvedFont: Font.Resolved {
4244
font.resolve(in: fontResolutionContext)
4345
}

Sources/SwiftCrossUI/Values/Font.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,10 @@ public struct Font: Hashable, Sendable {
217217
public struct Context: Sendable {
218218
var overlay: Font.Overlay
219219
var deviceClass: DeviceClass
220-
var resolveTextStyle: @Sendable (TextStyle) -> TextStyle.Resolved
220+
var resolveTextStyle: @MainActor @Sendable (TextStyle) -> TextStyle.Resolved
221221
}
222222

223+
@MainActor
223224
package func resolve(in context: Context) -> Resolved {
224225
let emphasizedWeight: Weight
225226
var resolved: Resolved

Sources/SwiftCrossUI/Values/TextStyle.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extension Font {
2828

2929
extension Font.TextStyle {
3030
/// A text style's resolved properties.
31-
public struct Resolved {
31+
public struct Resolved: Sendable {
3232
public var pointSize: Double
3333
public var weight: Font.Weight = .regular
3434
public var emphasizedWeight: Font.Weight

Sources/SwiftCrossUI/Views/Toggle.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public struct Toggle: View {
3939
}
4040

4141
/// A style of toggle.
42-
public struct ToggleStyle {
42+
public struct ToggleStyle: Sendable {
4343
package var style: Style
4444

4545
/// A toggle switch.

0 commit comments

Comments
 (0)