Skip to content

Commit fa08f68

Browse files
committed
Bump to Swift 6.1 in preparation for AndroidBackend (fix conc warnings)
1 parent d9cc075 commit fa08f68

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.10
1+
// swift-tools-version:6.1
22

33
import CompilerPluginSupport
44
import Foundation

Sources/SwiftCrossUI/Environment/Actions/DismissAction.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
/// ```
2121
@MainActor
2222
public struct DismissAction {
23-
private let action: () -> Void
23+
private nonisolated let action: @MainActor () -> Void
2424

25-
internal init(action: @escaping () -> Void) {
25+
nonisolated init(action: @MainActor @escaping () -> Void) {
2626
self.action = action
2727
}
2828

@@ -34,7 +34,6 @@ public struct DismissAction {
3434

3535
/// Environment key for the dismiss action.
3636
private struct DismissActionKey: EnvironmentKey {
37-
@MainActor
3837
static var defaultValue: DismissAction {
3938
DismissAction(action: {
4039
#if DEBUG
@@ -52,7 +51,7 @@ extension EnvironmentValues {
5251
///
5352
/// Example:
5453
/// ```swift
55-
/// struct ContentView: View {
54+
/// struct SheetContentView: View {
5655
/// @Environment(\.dismiss) var dismiss
5756
///
5857
/// var body: some View {

Sources/SwiftCrossUI/Views/Shapes/Shape.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
///
33
/// If no stroke color or fill color is specified, the default is no stroke and a fill of the
44
/// current foreground color.
5-
public protocol Shape: View, Sendable where Content == EmptyView {
5+
public protocol Shape: View, Sendable, _RemoveGlobalActorIsolation where Content == EmptyView {
66
/// Draw the path for this shape.
77
///
88
/// The bounds passed to a shape that is immediately drawn as a view will always have an
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@globalActor
2+
public actor _GlobalActorToDisableGlobalActorInference {
3+
public static let shared = _GlobalActorToDisableGlobalActorInference()
4+
}
5+
6+
/// Protocols that inherit from an actor-isolated protocol (such as View)
7+
/// and `_RemoveGlobalActorIsolation` end up without an inferred isolation.
8+
///
9+
/// This is useful for protocols such as Shape which inherit from an
10+
/// actor-isolated protocol but don't themselves need the isolation for
11+
/// members that aren't a direct requirement of the isolated protocol.
12+
@_GlobalActorToDisableGlobalActorInference
13+
public protocol _RemoveGlobalActorIsolation {}

0 commit comments

Comments
 (0)