feat: Resolving concurrency warnings
This commit is contained in:
@@ -23,22 +23,24 @@ public struct FlaggedStatusLabel: View {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public protocol FlaggedStatusLabelStyle {
|
||||
@MainActor
|
||||
@preconcurrency
|
||||
public protocol FlaggedStatusLabelStyle: Sendable {
|
||||
associatedtype Body: View
|
||||
typealias Configuration = FlaggedStatusLabelStyleConfiguration
|
||||
|
||||
func makeBody(configuration: Self.Configuration) -> Self.Body
|
||||
}
|
||||
|
||||
public struct FlaggedStatusLabelStyleConfiguration {
|
||||
public struct FlaggedStatusLabelStyleConfiguration : Sendable{
|
||||
public let status: Flagged.CheckResult.Status
|
||||
}
|
||||
|
||||
public struct AnyFlaggedStatusLabelStyle: FlaggedStatusLabelStyle {
|
||||
private let _makeBody: (Configuration) -> AnyView
|
||||
|
||||
internal init(makeBody: @escaping (Configuration) -> AnyView) {
|
||||
@MainActor
|
||||
public struct AnyFlaggedStatusLabelStyle: FlaggedStatusLabelStyle, Sendable {
|
||||
private let _makeBody: @Sendable (Configuration) -> AnyView
|
||||
|
||||
internal init(makeBody: @escaping @Sendable (Configuration) -> AnyView) {
|
||||
self._makeBody = makeBody
|
||||
}
|
||||
|
||||
@@ -57,7 +59,7 @@ public struct FlaggedStatusTextLabelStyle: FlaggedStatusLabelStyle {
|
||||
|
||||
let textLabelStyle: AnyTextLabelStyle?
|
||||
|
||||
public func makeBody(configuration: Configuration) -> some View {
|
||||
@MainActor public func makeBody(configuration: Configuration) -> some View {
|
||||
TextLabel(configuration.status.title)
|
||||
.textLabelStyle(
|
||||
textLabelStyle
|
||||
@@ -68,8 +70,8 @@ public struct FlaggedStatusTextLabelStyle: FlaggedStatusLabelStyle {
|
||||
}
|
||||
}
|
||||
|
||||
private struct FlaggedStatusLabelStyleKey: EnvironmentKey {
|
||||
static var defaultValue = AnyFlaggedStatusLabelStyle(
|
||||
private struct FlaggedStatusLabelStyleKey: @preconcurrency EnvironmentKey {
|
||||
@MainActor static let defaultValue = AnyFlaggedStatusLabelStyle(
|
||||
FlaggedStatusTextLabelStyle(
|
||||
textLabelStyle: AnyTextLabelStyle(
|
||||
style: .font(.callout, fontWeight: .bold)
|
||||
|
||||
Reference in New Issue
Block a user