From 46793c3dd95193cd6581b2c473ec67b39fcc76a4 Mon Sep 17 00:00:00 2001 From: Pavel Holec Date: Tue, 12 Nov 2024 10:53:32 +0100 Subject: [PATCH] Swift6 code update --- Sources/Orbit/Foundation/Typography/OrbitFont.swift | 4 ++-- Sources/Orbit/Support/BindingSource.swift | 2 ++ Sources/Orbit/Support/Previews/PreviewWrapper.swift | 2 +- Sources/Orbit/Support/Text/TextRepresentable.swift | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Sources/Orbit/Foundation/Typography/OrbitFont.swift b/Sources/Orbit/Foundation/Typography/OrbitFont.swift index ce56b33a0b3..4f853d624f8 100644 --- a/Sources/Orbit/Foundation/Typography/OrbitFont.swift +++ b/Sources/Orbit/Foundation/Typography/OrbitFont.swift @@ -16,7 +16,7 @@ struct OrbitFont: ViewModifier { public extension View { /// Sets the Orbit font as a default font for text in this view. - func orbitFont(size: CGFloat, weight: Font.Weight = .regular) -> some View { + nonisolated func orbitFont(size: CGFloat, weight: Font.Weight = .regular) -> some View { modifier(OrbitFont(size: size, weight: weight)) } } @@ -24,7 +24,7 @@ public extension View { public extension SwiftUI.Text { /// Sets the Orbit font as a default font for text in this view. - func orbitFont( + nonisolated func orbitFont( size: CGFloat, weight: Font.Weight = .regular, sizeCategory: ContentSizeCategory diff --git a/Sources/Orbit/Support/BindingSource.swift b/Sources/Orbit/Support/BindingSource.swift index 2c056a1f563..3cb6c904602 100644 --- a/Sources/Orbit/Support/BindingSource.swift +++ b/Sources/Orbit/Support/BindingSource.swift @@ -6,6 +6,8 @@ public enum OptionalBindingSource { case state(Value) } +extension Binding: Sendable where Value: Sendable {} + extension OptionalBindingSource: Sendable where Value: Sendable {} /// A view that provides either a binding to its content or an internal state, based on provided ``OptionalBindingSource`` value. diff --git a/Sources/Orbit/Support/Previews/PreviewWrapper.swift b/Sources/Orbit/Support/Previews/PreviewWrapper.swift index 742caca348d..ce30cc17cbc 100644 --- a/Sources/Orbit/Support/Previews/PreviewWrapper.swift +++ b/Sources/Orbit/Support/Previews/PreviewWrapper.swift @@ -1,7 +1,7 @@ import SwiftUI /// Registers Orbit fonts for preview content. -public struct OrbitPreviewWrapper: View { +@MainActor public struct OrbitPreviewWrapper: View { @ViewBuilder let content: Content diff --git a/Sources/Orbit/Support/Text/TextRepresentable.swift b/Sources/Orbit/Support/Text/TextRepresentable.swift index faf85e6523a..17cea8484a9 100644 --- a/Sources/Orbit/Support/Text/TextRepresentable.swift +++ b/Sources/Orbit/Support/Text/TextRepresentable.swift @@ -267,7 +267,7 @@ struct TextConcatenationPreviews: PreviewProvider { extension View { /// Textual representation of view. - func text(locale: Locale, localizationBundle: Bundle) -> SwiftUI.Text? { + @MainActor func text(locale: Locale, localizationBundle: Bundle) -> SwiftUI.Text? { switch self { case let text as SwiftUI.Text: text case let text as TextRepresentable: text.text(environment: .init(locale: locale, localizationBundle: localizationBundle))