feat: Resolving concurrency warnings
This commit is contained in:
@@ -9,22 +9,6 @@ public enum NextButtonType { }
|
||||
/// A name space for info button styles.
|
||||
public enum ResetButtonType { }
|
||||
|
||||
/// A type erased button style, used to style buttons in a namespace.
|
||||
//@MainActor
|
||||
//public struct AnyButtonStyle<ButtonType>: ButtonStyle, Sendable {
|
||||
// private let _makeBody: @Sendable (Configuration) -> AnyView
|
||||
//
|
||||
// public init<S: ButtonStyle>(_ style: S) where S: Sendable, S.Body: Sendable {
|
||||
// self._makeBody = { configuration in
|
||||
// AnyView(style.makeBody(configuration: configuration))
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public func makeBody(configuration: Configuration) -> some View {
|
||||
// self._makeBody(configuration)
|
||||
// }
|
||||
//}
|
||||
|
||||
/// A type erased primitive button style, used to style buttons in a namespace.
|
||||
@MainActor
|
||||
public struct AnyPrimitiveButtonStyle<ButtonType>: PrimitiveButtonStyle {
|
||||
@@ -113,16 +97,6 @@ extension AnyPrimitiveButtonStyle<NextButtonType> {
|
||||
public static var toolbar: Self { .init(ToolbarNextButtonStyle()) }
|
||||
}
|
||||
|
||||
//extension AnyButtonStyle where ButtonType == InfoButtonType {
|
||||
// public static var `default`: Self {
|
||||
// .init(DefaultInfoButtonStyle<IconOnlyLabelStyle>(labelStyle: .iconOnly))
|
||||
// }
|
||||
//
|
||||
// public static func `default`<S: LabelStyle>(color: Color, font: Font, labelStyle: S) -> Self {
|
||||
// .init(DefaultInfoButtonStyle<S>(color: color, font: font, labelStyle: labelStyle))
|
||||
// }
|
||||
//}
|
||||
|
||||
private struct InfoButtonStyleKey: @preconcurrency EnvironmentKey {
|
||||
@MainActor
|
||||
static var defaultValue: AnyPrimitiveButtonStyle<InfoButtonType> {
|
||||
@@ -131,16 +105,19 @@ private struct InfoButtonStyleKey: @preconcurrency EnvironmentKey {
|
||||
}
|
||||
|
||||
private struct NextButtonStyleKey: EnvironmentKey {
|
||||
@MainActor
|
||||
static var defaultValue: AnyPrimitiveButtonStyle<NextButtonType> {
|
||||
AnyPrimitiveButtonStyle<NextButtonType>(
|
||||
DefaultNextButtonStyle<BorderedProminentButtonStyle, NextLabelStyle>()
|
||||
)
|
||||
MainActor.assumeIsolated {
|
||||
AnyPrimitiveButtonStyle<NextButtonType>(
|
||||
DefaultNextButtonStyle<BorderedProminentButtonStyle, NextLabelStyle>()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct ResetButtonStyleKey: EnvironmentKey {
|
||||
static let defaultValue = AnyPrimitiveButtonStyle<ResetButtonType>(.borderedProminent)
|
||||
static let defaultValue = MainActor.assumeIsolated {
|
||||
AnyPrimitiveButtonStyle<ResetButtonType>(.borderedProminent)
|
||||
}
|
||||
}
|
||||
|
||||
extension EnvironmentValues {
|
||||
|
||||
Reference in New Issue
Block a user