diff --git a/Automation/update_country_flags.py b/Automation/update_country_flags.py index a356f370753..543e64165b6 100755 --- a/Automation/update_country_flags.py +++ b/Automation/update_country_flags.py @@ -20,7 +20,7 @@ source_template = source_header + '''public extension CountryFlag {{ - enum CountryCode: String, CaseIterable {{ + enum CountryCode: String, CaseIterable, Sendable {{ {cases} }} }} diff --git a/Automation/update_icons.py b/Automation/update_icons.py index c43a0f18954..2a311f894ce 100755 --- a/Automation/update_icons.py +++ b/Automation/update_icons.py @@ -23,7 +23,7 @@ source_template = source_header + '''public extension Icon {{ - enum Symbol: CaseIterable, Equatable {{ + enum Symbol: CaseIterable, Equatable, Sendable {{ {cases} public var value: String {{ @@ -97,8 +97,8 @@ def iconsFolderPath(): swift_icon_key = dots_to_camel_case(swift_icon_name) case_lines.append(f" /// Orbit `{swift_icon_name}` icon symbol.\n case {swift_icon_key}") - value_lines.append(f" case .{swift_icon_key}: return \"{swift_value}\"") - + value_lines.append(f" case .{swift_icon_key}: \"{swift_value}\"") + updated_file_content = source_template.format(cases = '\n'.join(case_lines), values = '\n'.join(value_lines)) with open(icons_swift_path, "w+") as source_file: diff --git a/Sources/Orbit/Components/BadgeList.swift b/Sources/Orbit/Components/BadgeList.swift index 9a15dd8431a..f244fefd0ce 100644 --- a/Sources/Orbit/Components/BadgeList.swift +++ b/Sources/Orbit/Components/BadgeList.swift @@ -148,7 +148,7 @@ public extension BadgeList where Icon == Orbit.Icon, Label == Text { // MARK: - Types /// A type of Orbit ``BadgeList``. -public enum BadgeListType: Equatable, Hashable { +public enum BadgeListType: Equatable, Hashable, Sendable { case neutral case status(_ status: Status?) // FIXME: Remove and use override modifiers diff --git a/Sources/Orbit/Components/ButtonLink.swift b/Sources/Orbit/Components/ButtonLink.swift index c7bd8c34346..05ccb3f709a 100644 --- a/Sources/Orbit/Components/ButtonLink.swift +++ b/Sources/Orbit/Components/ButtonLink.swift @@ -148,7 +148,7 @@ public extension ButtonLink where Label == Text, LeadingIcon == Orbit.Icon, Trai // MARK: - Types /// A predefined type of Orbit ``ButtonLink``. -public enum ButtonLinkType: Equatable { +public enum ButtonLinkType: Equatable, Sendable { case primary case critical case status(_ status: Status?) diff --git a/Sources/Orbit/Components/Checkbox.swift b/Sources/Orbit/Components/Checkbox.swift index e57be524bf3..09e894a6b4f 100644 --- a/Sources/Orbit/Components/Checkbox.swift +++ b/Sources/Orbit/Components/Checkbox.swift @@ -141,7 +141,7 @@ public extension Checkbox where Title == Text, Description == Text { // MARK: - Types /// A state of Orbit ``Checkbox``. -public enum CheckboxState { +public enum CheckboxState: Sendable { case normal case error } diff --git a/Sources/Orbit/Components/ChoiceTile.swift b/Sources/Orbit/Components/ChoiceTile.swift index 0443e8947f1..4375721a1f9 100644 --- a/Sources/Orbit/Components/ChoiceTile.swift +++ b/Sources/Orbit/Components/ChoiceTile.swift @@ -421,14 +421,14 @@ public extension ChoiceTile where Badge == Orbit.Badge: View { // MARK: - Types /// Width for all items used in Orbit ``HorizontalScroll``. -public enum HorizontalScrollItemWidth { +public enum HorizontalScrollItemWidth: Sendable { /// Width ratio calculated from the available container width. case ratio(CGFloat = 0.48, maxWidth: CGFloat? = Layout.readableMaxWidth - 270) /// Custom fixed width. diff --git a/Sources/Orbit/Components/Icon.swift b/Sources/Orbit/Components/Icon.swift index e5511f97b0a..e4c04a6590d 100644 --- a/Sources/Orbit/Components/Icon.swift +++ b/Sources/Orbit/Components/Icon.swift @@ -180,7 +180,7 @@ public extension Icon { public extension Icon { /// Preferred Orbit ``Icon`` size in both dimensions. The actual size may differ based on icon content. - enum Size: Equatable { + enum Size: Equatable, Sendable { /// Size 16. case small /// Size 20. @@ -210,7 +210,7 @@ public extension Icon { // MARK: - Private private extension Icon { - enum Content { + enum Content: Sendable { case symbol(Symbol) case sfSymbol(String) diff --git a/Sources/Orbit/Components/ListChoice.swift b/Sources/Orbit/Components/ListChoice.swift index 5bb7db4d9f3..d4e559a7a87 100644 --- a/Sources/Orbit/Components/ListChoice.swift +++ b/Sources/Orbit/Components/ListChoice.swift @@ -333,10 +333,10 @@ public extension ListChoice where Title == Text, Description == Text, Header == // MARK: - Types /// Disclosure used in Orbit ``ListChoice``. -public enum ListChoiceDisclosure: Equatable { +public enum ListChoiceDisclosure: Equatable, Sendable { /// Orbit ``ListChoiceDisclosure`` button type. - public enum ButtonType { + public enum ButtonType: Sendable { case add case remove } diff --git a/Sources/Orbit/Components/Radio.swift b/Sources/Orbit/Components/Radio.swift index deb7badf1fe..50facaa5c40 100644 --- a/Sources/Orbit/Components/Radio.swift +++ b/Sources/Orbit/Components/Radio.swift @@ -141,7 +141,7 @@ public extension Radio where Title == Text, Description == Text { // MARK: - Types /// A state of Orbit ``Radio``. -public enum RadioState { +public enum RadioState: Sendable { case normal case error } diff --git a/Sources/Orbit/Components/Skeleton.swift b/Sources/Orbit/Components/Skeleton.swift index 9d4eb9fa634..9b034e773e9 100644 --- a/Sources/Orbit/Components/Skeleton.swift +++ b/Sources/Orbit/Components/Skeleton.swift @@ -102,9 +102,9 @@ public struct Skeleton: View { extension Skeleton { /// Orbit ``Skeleton`` shape and size preset. - public enum Preset { - - public enum Atomic { + public enum Preset: Sendable { + + public enum Atomic: Sendable { case circle case rectangle } diff --git a/Sources/Orbit/Components/Tile.swift b/Sources/Orbit/Components/Tile.swift index 9988f8fbbb1..ab3869be159 100644 --- a/Sources/Orbit/Components/Tile.swift +++ b/Sources/Orbit/Components/Tile.swift @@ -261,7 +261,8 @@ public extension Tile where Title == Heading, Description == Text, Icon == Orbit // MARK: - Types -public enum TileDisclosure: Equatable { +// FIXME: remove @unchecked if `LocalizedStringKey` becomes `Sendable` +public enum TileDisclosure: Equatable, @unchecked Sendable { /// Icon with optional color override. case icon(Icon.Symbol, alignment: VerticalAlignment = .center) /// ButtonLink indicator. diff --git a/Sources/Orbit/Foundation/Borders/BorderRadius.swift b/Sources/Orbit/Foundation/Borders/BorderRadius.swift index 4f9d5cfe722..5c1ad451995 100644 --- a/Sources/Orbit/Foundation/Borders/BorderRadius.swift +++ b/Sources/Orbit/Foundation/Borders/BorderRadius.swift @@ -3,7 +3,7 @@ import CoreGraphics /// Orbit predefined border radiuses. /// /// - Note: [Orbit.kiwi documentation](https://orbit.kiwi/foundation/border-radiuses/) -public enum BorderRadius { +public enum BorderRadius: Sendable { /// 2 pts border radius. public static let xxSmall: CGFloat = 2 /// 3 pts border radius. diff --git a/Sources/Orbit/Foundation/Borders/BorderWidth.swift b/Sources/Orbit/Foundation/Borders/BorderWidth.swift index 8b5d3d752e3..c4dcfade1da 100644 --- a/Sources/Orbit/Foundation/Borders/BorderWidth.swift +++ b/Sources/Orbit/Foundation/Borders/BorderWidth.swift @@ -2,7 +2,7 @@ import CoreGraphics import UIKit /// Predefiend Orbit border widths. -public enum BorderWidth { +public enum BorderWidth: Sendable { /// 1 pixel border width. public static let hairline: CGFloat = 1.0 / UIScreen.main.scale /// 0.5 pt border width. diff --git a/Sources/Orbit/Foundation/Colors/Gradients.swift b/Sources/Orbit/Foundation/Colors/Gradients.swift index 6e8f43a2975..31c83040833 100644 --- a/Sources/Orbit/Foundation/Colors/Gradients.swift +++ b/Sources/Orbit/Foundation/Colors/Gradients.swift @@ -1,7 +1,7 @@ import SwiftUI /// Predefined Orbit gradient styles. -public enum Gradient { +public enum Gradient: Sendable { case bundleBasic case bundleMedium diff --git a/Sources/Orbit/Foundation/CountryFlags/CountryFlags.swift b/Sources/Orbit/Foundation/CountryFlags/CountryFlags.swift index d5ca62f0710..f261244dccc 100644 --- a/Sources/Orbit/Foundation/CountryFlags/CountryFlags.swift +++ b/Sources/Orbit/Foundation/CountryFlags/CountryFlags.swift @@ -2,7 +2,7 @@ // Generated by 'Automation/update_country_flags.py' public extension CountryFlag { - enum CountryCode: String, CaseIterable { + enum CountryCode: String, CaseIterable, Sendable { /// Country code for Andorra case ad @@ -633,6 +633,7 @@ public extension CountryFlag { /// Country code for Suriname case sr + /// Country code for South Sudan case ss /// Country code for São Tomé and Príncipe @@ -641,6 +642,7 @@ public extension CountryFlag { /// Country code for El Salvador case sv + /// Country code for Saint Martin case sx /// Country code for Syria @@ -743,6 +745,7 @@ public extension CountryFlag { /// Country code for Samoa case ws + /// Country code for Kosovo case xk /// Country code for Yemen diff --git a/Sources/Orbit/Foundation/Elevations/Elevation.swift b/Sources/Orbit/Foundation/Elevations/Elevation.swift index 6207c7a798a..01aabc12462 100644 --- a/Sources/Orbit/Foundation/Elevations/Elevation.swift +++ b/Sources/Orbit/Foundation/Elevations/Elevation.swift @@ -3,7 +3,7 @@ import SwiftUI /// Predefined Orbit elevation that brings content closer to user. /// /// Elevation levels with higher numbers are usually visually closer to the user. -public enum Elevation { +public enum Elevation: Sendable { case level1 case level2 case level3 @@ -12,7 +12,7 @@ public enum Elevation { } /// A shape to use as a surface on which Orbit `elevation` is applied. -public enum ElevationShape { +public enum ElevationShape: Sendable { /// Elevation effect shape is based on provided content. /// /// To improve performance, the elevation can be applied on multiple views at once diff --git a/Sources/Orbit/Foundation/Icons/Icons.swift b/Sources/Orbit/Foundation/Icons/Icons.swift index e09ade61a81..9087180e455 100644 --- a/Sources/Orbit/Foundation/Icons/Icons.swift +++ b/Sources/Orbit/Foundation/Icons/Icons.swift @@ -2,7 +2,7 @@ // Generated by 'Automation/update_icons.py' public extension Icon { - enum Symbol: CaseIterable, Equatable { + enum Symbol: CaseIterable, Equatable, Sendable { /// Orbit `accommodation` icon symbol. case accommodation /// Orbit `accountCircle` icon symbol. diff --git a/Sources/Orbit/Foundation/Spacing/Spacing.swift b/Sources/Orbit/Foundation/Spacing/Spacing.swift index a043f16c3cd..3dfc238ec82 100644 --- a/Sources/Orbit/Foundation/Spacing/Spacing.swift +++ b/Sources/Orbit/Foundation/Spacing/Spacing.swift @@ -3,7 +3,7 @@ import SwiftUI /// Predefined Orbit spacing to help making interface clear and easy to scan. /// /// - Note: [Orbit.kiwi documentation](https://orbit.kiwi/foundation/spacing/) -public enum Spacing: CGFloat { +public enum Spacing: CGFloat, Sendable { /// 2 pts. case xxxSmall = 2 /// 4 pts. diff --git a/Sources/Orbit/Foundation/Typography/Font.swift b/Sources/Orbit/Foundation/Typography/Font.swift index da805518532..ea385dc88bb 100644 --- a/Sources/Orbit/Foundation/Typography/Font.swift +++ b/Sources/Orbit/Foundation/Typography/Font.swift @@ -11,7 +11,7 @@ public extension Font { static var fontSizeToLineHeightRatio: CGFloat = 1.3333 /// Default Orbit fonts used for rendering text. - static var orbitFonts: [Font.Weight: URL?] = [ + @MainActor static var orbitFonts: [Font.Weight: URL?] = [ .ultraLight: Bundle.orbit.url(forResource: "Circular20-Book", withExtension: "otf"), .thin: Bundle.orbit.url(forResource: "Circular20-Book", withExtension: "otf"), .light: Bundle.orbit.url(forResource: "Circular20-Book", withExtension: "otf"), @@ -44,7 +44,7 @@ public extension Font { } /// Registers Orbit fonts set in the `Font.orbitFonts` property for use in all Orbit text components. - static func registerOrbitFonts() { + @MainActor static func registerOrbitFonts() { var registeredFonts: [URL: CGFont] = [:] for case let (weight, url?) in orbitFonts { diff --git a/Sources/Orbit/Support/BindingSource.swift b/Sources/Orbit/Support/BindingSource.swift index 83beee687fd..2c056a1f563 100644 --- a/Sources/Orbit/Support/BindingSource.swift +++ b/Sources/Orbit/Support/BindingSource.swift @@ -6,6 +6,8 @@ public enum OptionalBindingSource { case state(Value) } +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. /// /// The binding can either be supplied, in which case it is used directly, diff --git a/Sources/Orbit/Support/Components/TabStyle.swift b/Sources/Orbit/Support/Components/TabStyle.swift index ca94b68b4f1..f4dc4546365 100644 --- a/Sources/Orbit/Support/Components/TabStyle.swift +++ b/Sources/Orbit/Support/Components/TabStyle.swift @@ -3,7 +3,7 @@ import SwiftUI /// Orbit ``Tabs`` style applied to the active tab. /// /// To apply a style, use the `activeTabStyle()` modifier. -public enum TabStyle: Equatable { +public enum TabStyle: Equatable, Sendable { case `default` case underlined(Color) case underlinedGradient(Orbit.Gradient) diff --git a/Sources/Orbit/Support/Components/TimelineItem.swift b/Sources/Orbit/Support/Components/TimelineItem.swift index 24e207b3175..44432f7a6fd 100644 --- a/Sources/Orbit/Support/Components/TimelineItem.swift +++ b/Sources/Orbit/Support/Components/TimelineItem.swift @@ -122,10 +122,10 @@ public extension TimelineItem where Label == Heading, Sublabel == Text, Descript // MARK: - Types /// Orbit ``TimelineItem`` type. -public enum TimelineItemType: Equatable { +public enum TimelineItemType: Equatable, Sendable { /// Orbit ``TimelineItemType`` status. - public enum Status { + public enum Status: Sendable { case success case warning case critical @@ -139,32 +139,30 @@ public enum TimelineItemType: Equatable { public var icon: Icon.Symbol? { switch self { - case .past: return .checkCircle - case .present(.critical): return .closeCircle - case .present(.warning): return .alertCircle - case .present(.success): return .checkCircle - case .present: return nil - case .future: return nil + case .past: .checkCircle + case .present(.critical): .closeCircle + case .present(.warning): .alertCircle + case .present(.success): .checkCircle + case .present: nil + case .future: nil } } public var color: Color { switch self { - case .past: return Orbit.Status.success.color - case .present(.critical): return Orbit.Status.critical.color - case .present(.warning): return Orbit.Status.warning.color - case .present(.success): return Orbit.Status.success.color - case .present: return Orbit.Status.success.color - case .future: return .cloudNormalHover + case .past: Orbit.Status.success.color + case .present(.critical): Orbit.Status.critical.color + case .present(.warning): Orbit.Status.warning.color + case .present(.success): Orbit.Status.success.color + case .present: Orbit.Status.success.color + case .future: .cloudNormalHover } } public var isCurrentStep: Bool { switch self { - case .present: - return true - case .past, .future: - return false + case .present: true + case .past, .future: false } } @@ -174,10 +172,8 @@ public enum TimelineItemType: Equatable { public var isLineDashed: Bool { switch self { - case .future: - return true - case .past, .present: - return false + case .future: true + case .past, .present: false } } } diff --git a/Sources/Orbit/Support/Environment Keys/BackgroundShapeKey.swift b/Sources/Orbit/Support/Environment Keys/BackgroundShapeKey.swift index e1273a8761c..d14372bf124 100644 --- a/Sources/Orbit/Support/Environment Keys/BackgroundShapeKey.swift +++ b/Sources/Orbit/Support/Environment Keys/BackgroundShapeKey.swift @@ -1,7 +1,7 @@ import SwiftUI /// Stores background shapes used for Orbit components that render their own background, such as `Card` or `Tile`. -public struct BackgroundShape { +public struct BackgroundShape: Sendable { public let inactive: any ShapeStyle public let active: any ShapeStyle diff --git a/Sources/Orbit/Support/Environment Keys/ButtonPriorityKey.swift b/Sources/Orbit/Support/Environment Keys/ButtonPriorityKey.swift index 4d8ec26f6af..58e3e305f9c 100644 --- a/Sources/Orbit/Support/Environment Keys/ButtonPriorityKey.swift +++ b/Sources/Orbit/Support/Environment Keys/ButtonPriorityKey.swift @@ -1,7 +1,7 @@ import SwiftUI /// Orbit button priority. -public enum ButtonPriority { +public enum ButtonPriority: Sendable { case primary case secondary } diff --git a/Sources/Orbit/Support/Environment Keys/ButtonSizeKey.swift b/Sources/Orbit/Support/Environment Keys/ButtonSizeKey.swift index 54ca4dd8b6c..97c6c5992f0 100644 --- a/Sources/Orbit/Support/Environment Keys/ButtonSizeKey.swift +++ b/Sources/Orbit/Support/Environment Keys/ButtonSizeKey.swift @@ -1,7 +1,7 @@ import SwiftUI /// Orbit size used for various button components. -public enum ButtonSize { +public enum ButtonSize: Sendable { case regular case compact } diff --git a/Sources/Orbit/Support/Environment Keys/IdealSizeKey.swift b/Sources/Orbit/Support/Environment Keys/IdealSizeKey.swift index 8d7dbedf316..a9be8c21b74 100644 --- a/Sources/Orbit/Support/Environment Keys/IdealSizeKey.swift +++ b/Sources/Orbit/Support/Environment Keys/IdealSizeKey.swift @@ -1,7 +1,7 @@ import SwiftUI /// The expanding behaviour of compatible Orbit components in a view relative to their ideal size for each axis. -public struct IdealSizeValue { +public struct IdealSizeValue: Sendable { public var horizontal: Bool? public var vertical: Bool? } diff --git a/Sources/Orbit/Support/Forms/InputLabelStyle.swift b/Sources/Orbit/Support/Forms/InputLabelStyle.swift index 478bea62aa7..90d05190655 100644 --- a/Sources/Orbit/Support/Forms/InputLabelStyle.swift +++ b/Sources/Orbit/Support/Forms/InputLabelStyle.swift @@ -1,7 +1,7 @@ import SwiftUI /// Style variant for Orbit input label. -public enum InputLabelStyle { +public enum InputLabelStyle: Sendable { /// Style with label positioned above the input. case `default` diff --git a/Sources/Orbit/Support/Forms/InputState.swift b/Sources/Orbit/Support/Forms/InputState.swift index d05150e86ad..8395e960a35 100644 --- a/Sources/Orbit/Support/Forms/InputState.swift +++ b/Sources/Orbit/Support/Forms/InputState.swift @@ -1,15 +1,15 @@ import SwiftUI /// State of Orbit input components. -public enum InputState { +public enum InputState: Sendable { case `default` case modified public var textColor: Color { switch self { - case .default: return .inkDark - case .modified: return .blueDark + case .default: .inkDark + case .modified: .blueDark } } diff --git a/Sources/Orbit/Support/Forms/Message.swift b/Sources/Orbit/Support/Forms/Message.swift index 1bc7022a3a3..2780795fe00 100644 --- a/Sources/Orbit/Support/Forms/Message.swift +++ b/Sources/Orbit/Support/Forms/Message.swift @@ -1,7 +1,7 @@ import SwiftUI /// Orbit informational message used in forms. -public enum Message: Equatable, Hashable, CustomStringConvertible { +public enum Message: Equatable, Hashable, CustomStringConvertible, Sendable { case normal(String, icon: Icon.Symbol? = nil) case help(String, icon: Icon.Symbol? = .informationCircle) diff --git a/Sources/Orbit/Support/HapticsProvider.swift b/Sources/Orbit/Support/HapticsProvider.swift index af7fe9253c2..0998c7251c4 100644 --- a/Sources/Orbit/Support/HapticsProvider.swift +++ b/Sources/Orbit/Support/HapticsProvider.swift @@ -6,7 +6,7 @@ import SwiftUI /// Can be disabled by ``SwiftUI/View/hapticsDisabled(_:)``. public enum HapticsProvider { - public enum HapticFeedbackType { + public enum HapticFeedbackType: Sendable { case selection case light(_ intensity: CGFloat = 1.0) case medium(_ intensity: CGFloat = 1.0) diff --git a/Sources/Orbit/Support/Layout/Layout.swift b/Sources/Orbit/Support/Layout/Layout.swift index d8c343d950d..c5b5386bc01 100644 --- a/Sources/Orbit/Support/Layout/Layout.swift +++ b/Sources/Orbit/Support/Layout/Layout.swift @@ -3,7 +3,7 @@ import SwiftUI public enum Layout { /// Maximum readable width used for Orbit layout in regular width environment. - public static var readableMaxWidth: CGFloat = 672 + public static let readableMaxWidth: CGFloat = 672 } public extension Alignment { diff --git a/Sources/Orbit/Support/Layout/ScreenLayoutModifier.swift b/Sources/Orbit/Support/Layout/ScreenLayoutModifier.swift index 53645aab1fd..e18df42859a 100644 --- a/Sources/Orbit/Support/Layout/ScreenLayoutModifier.swift +++ b/Sources/Orbit/Support/Layout/ScreenLayoutModifier.swift @@ -1,7 +1,7 @@ import SwiftUI /// Padding to apply in Orbit `screenLayout` context. -public enum ScreenLayoutPadding { +public enum ScreenLayoutPadding: Sendable { /// Padding of `medium` size in compact horizontal size and `xxLarge` size in regular horizontal size. case `default` /// Padding of `medium` size in both compact and regular horizontal size. diff --git a/Sources/Orbit/Support/Resources/Images.swift b/Sources/Orbit/Support/Resources/Images.swift index 0748e8636c0..71860a36727 100644 --- a/Sources/Orbit/Support/Resources/Images.swift +++ b/Sources/Orbit/Support/Resources/Images.swift @@ -3,7 +3,7 @@ import SwiftUI public extension Image { /// Orbit image asset. - enum Asset: String, CaseIterable, AssetNameProviding { + enum Asset: String, CaseIterable, AssetNameProviding, Sendable { case apple case facebook diff --git a/Sources/Orbit/Support/Status.swift b/Sources/Orbit/Support/Status.swift index dc7d8f347fd..bef610bab6c 100644 --- a/Sources/Orbit/Support/Status.swift +++ b/Sources/Orbit/Support/Status.swift @@ -1,7 +1,7 @@ import SwiftUI /// Non-default status of Orbit components. -public enum Status: Equatable { +public enum Status: Equatable, Sendable { case info case success case warning @@ -13,99 +13,99 @@ public extension Status { /// Default icon associated with status. var icon: Icon.Symbol? { switch self { - case .info: return nil - case .success: return .informationCircle - case .warning: return .alert - case .critical: return .alertCircle + case .info: nil + case .success: .informationCircle + case .warning: .alert + case .critical: .alertCircle } } /// Color associated with status. var color: Color { switch self { - case .info: return .blueNormal - case .success: return .greenNormal - case .warning: return .orangeNormal - case .critical: return .redNormal + case .info: .blueNormal + case .success: .greenNormal + case .warning: .orangeNormal + case .critical: .redNormal } } /// Light color associated with status. var lightColor: Color { switch self { - case .info: return .blueLight - case .success: return .greenLight - case .warning: return .orangeLight - case .critical: return .redLight + case .info: .blueLight + case .success: .greenLight + case .warning: .orangeLight + case .critical: .redLight } } /// Light hover color associated with status. var lightHoverColor: Color { switch self { - case .info: return .blueLightHover - case .success: return .greenLightHover - case .warning: return .orangeLightHover - case .critical: return .redLightHover + case .info: .blueLightHover + case .success: .greenLightHover + case .warning: .orangeLightHover + case .critical: .redLightHover } } /// Dark color associated with status. var darkColor: Color { switch self { - case .info: return .blueDark - case .success: return .greenDark - case .warning: return .orangeDark - case .critical: return .redDark + case .info: .blueDark + case .success: .greenDark + case .warning: .orangeDark + case .critical: .redDark } } /// Dark hover color associated with status. var darkHoverColor: Color { switch self { - case .info: return .blueDarkHover - case .success: return .greenDarkHover - case .warning: return .orangeDarkHover - case .critical: return .redDarkHover + case .info: .blueDarkHover + case .success: .greenDarkHover + case .warning: .orangeDarkHover + case .critical: .redDarkHover } } /// Active color associated with status. var activeColor: Color { switch self { - case .info: return .blueNormalActive - case .success: return .greenNormalActive - case .warning: return .orangeNormalActive - case .critical: return .redNormalActive + case .info: .blueNormalActive + case .success: .greenNormalActive + case .warning: .orangeNormalActive + case .critical: .redNormalActive } } /// Dark active color associated with status. var darkActiveColor: Color { switch self { - case .info: return .blueDarkActive - case .success: return .greenDarkActive - case .warning: return .orangeDarkActive - case .critical: return .redDarkActive + case .info: .blueDarkActive + case .success: .greenDarkActive + case .warning: .orangeDarkActive + case .critical: .redDarkActive } } /// Light active color associated with status. var lightActiveColor: Color { switch self { - case .info: return .blueLightActive - case .success: return .greenLightActive - case .warning: return .orangeLightActive - case .critical: return .redLightActive + case .info: .blueLightActive + case .success: .greenLightActive + case .warning: .orangeLightActive + case .critical: .redLightActive } } /// The default haptic feedback associated with status. var defaultHapticFeedback: HapticsProvider.HapticFeedbackType { switch self { - case .info, .success: return .light(0.5) - case .warning: return .notification(.warning) - case .critical: return .notification(.error) + case .info, .success: .light(0.5) + case .warning: .notification(.warning) + case .critical: .notification(.error) } } } diff --git a/Sources/Orbit/Support/Text/TextRepresentable.swift b/Sources/Orbit/Support/Text/TextRepresentable.swift index ba0e2767445..f1f64ae9bba 100644 --- a/Sources/Orbit/Support/Text/TextRepresentable.swift +++ b/Sources/Orbit/Support/Text/TextRepresentable.swift @@ -3,7 +3,7 @@ import SwiftUI /// A type that can be represented as `SwiftUI.Text` and can serve as Orbit concatenable component. /// /// Use the `+` operator to concatenate ``TextRepresentable`` elements. -public protocol TextRepresentable { +@MainActor public protocol TextRepresentable { /// The native `SwiftUI.Text` representation. func text(environment: TextRepresentableEnvironment) -> SwiftUI.Text? diff --git a/Sources/Orbit/Support/TextFields/TextField.swift b/Sources/Orbit/Support/TextFields/TextField.swift index 3a7790487fd..f55be692ffd 100644 --- a/Sources/Orbit/Support/TextFields/TextField.swift +++ b/Sources/Orbit/Support/TextFields/TextField.swift @@ -188,7 +188,7 @@ public extension TextField { // MARK: - Types /// The result of Orbit `inputFieldShouldChangeCharactersAction`. -public enum InputFieldShouldChangeResult { +public enum InputFieldShouldChangeResult: Sendable { /// Specifies that proposed changes should be accepted. case accept /// Specifies that proposed changes should not be accepted, making the `InputField` keeping the previous value. diff --git a/Sources/OrbitIllustrations/Resources/Illustrations.swift b/Sources/OrbitIllustrations/Resources/Illustrations.swift index 04e8390c482..7146543625a 100644 --- a/Sources/OrbitIllustrations/Resources/Illustrations.swift +++ b/Sources/OrbitIllustrations/Resources/Illustrations.swift @@ -3,7 +3,7 @@ import Orbit public extension Illustration { - enum Asset: String, CaseIterable, AssetNameProviding { + enum Asset: String, CaseIterable, AssetNameProviding, Sendable { case accommodation case airHelp case airportShuttle diff --git a/Tests/SnapshotTests/SnapshotTestCase.swift b/Tests/SnapshotTests/SnapshotTestCase.swift index 16811e7903d..6083acd0c73 100644 --- a/Tests/SnapshotTests/SnapshotTestCase.swift +++ b/Tests/SnapshotTests/SnapshotTestCase.swift @@ -3,7 +3,7 @@ import Orbit import SwiftUI import SnapshotTesting -class SnapshotTestCase: XCTestCase { +@MainActor class SnapshotTestCase: XCTestCase { override class func setUp() { super.setUp()