Skip to content

Commit 406910d

Browse files
committed
Disable werror due to warning of cucurrency
1 parent b936f0b commit 406910d

File tree

4 files changed

+49
-47
lines changed

4 files changed

+49
-47
lines changed

Package.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func envEnable(_ key: String, default defaultValue: Bool = false) -> Bool {
2020
var sharedSwiftSettings: [SwiftSetting] = [
2121
.enableUpcomingFeature("BareSlashRegexLiterals"),
2222
.enableUpcomingFeature("InternalImportsByDefault"),
23+
.enableUpcomingFeature("InferSendableFromCaptures"),
2324
.define("OPENSWIFTUI_SUPPRESS_DEPRECATED_WARNINGS"),
2425
.swiftLanguageMode(.v5),
2526
]
@@ -74,7 +75,11 @@ if development {
7475

7576
let warningsAsErrorsCondition = envEnable("OPENSWIFTUI_WERROR", default: isXcodeEnv && development)
7677
if warningsAsErrorsCondition {
77-
sharedSwiftSettings.append(.unsafeFlags(["-warnings-as-errors"]))
78+
// Hold off the werror feature as we can't avoid the concurrency warning.
79+
// Reenable the folllowing after swift-evolution#443 is release.
80+
81+
// sharedSwiftSettings.append(.unsafeFlags(["-warnings-as-errors"]))
82+
// sharedSwiftSettings.append(.unsafeFlags(["-Wwarning", "concurrency"]))
7883
}
7984

8085
// NOTE:

Sources/OpenSwiftUICore/Modifier/ViewModifier/PrimitiveViewModifier.swift

Lines changed: 0 additions & 8 deletions
This file was deleted.

Sources/OpenSwiftUICore/Modifier/ViewModifier/TODO/_EnvironmentKeyWritingModifier.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
// Status: WIP
77

88
@frozen
9-
public struct _EnvironmentKeyWritingModifier<Value>: ViewModifier/*, _GraphInputsModifier*/ {
9+
public struct _EnvironmentKeyWritingModifier<Value>: ViewModifier, _GraphInputsModifier, PrimitiveViewModifier {
1010
public var keyPath: WritableKeyPath<EnvironmentValues, Value>
1111
public var value: Value
1212

1313
@inlinable
14-
@inline(__always)
1514
public init(keyPath: WritableKeyPath<EnvironmentValues, Value>, value: Value) {
1615
self.keyPath = keyPath
1716
self.value = value
@@ -20,11 +19,15 @@ public struct _EnvironmentKeyWritingModifier<Value>: ViewModifier/*, _GraphInput
2019
public static func _makeInputs(modifier: _GraphValue<_EnvironmentKeyWritingModifier<Value>>, inputs: inout _GraphInputs) {
2120
// TODO
2221
}
22+
23+
2324
}
2425

26+
@available(*, unavailable)
27+
extension _EnvironmentKeyWritingModifier: Sendable {}
28+
2529
extension View {
2630
@inlinable
27-
@inline(__always)
2831
nonisolated public func environment<V>(_ keyPath: WritableKeyPath<EnvironmentValues, V>, _ value: V) -> some View {
2932
modifier(_EnvironmentKeyWritingModifier<V>(keyPath: keyPath, value: value))
3033
}

Sources/OpenSwiftUICore/Modifier/ViewModifier/ViewModifier.swift

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// ViewModifier.swift
3-
// OpenSwiftUI
3+
// OpenSwiftUICore
44
//
55
// Audited for iOS 15.5
66
// Status: Complete
@@ -48,68 +48,45 @@
4848
/// Downtown Bus. A view extension, using custom a modifier, renders the
4949
/// caption in blue text surrounded by a rounded
5050
/// rectangle.](OpenSwiftUI-View-ViewModifier.png)
51+
@MainActor
52+
@preconcurrency
5153
public protocol ViewModifier {
52-
/// The type of view representing the body.
53-
associatedtype Body: View
54-
5554
/// Makes a new view using the view modifier and inputs that you provide.
56-
static func _makeView(
55+
nonisolated static func _makeView(
5756
modifier: _GraphValue<Self>,
5857
inputs: _ViewInputs,
5958
body: @escaping (_Graph, _ViewInputs) -> _ViewOutputs
6059
) -> _ViewOutputs
6160

62-
static func _makeViewList(
61+
nonisolated static func _makeViewList(
6362
modifier: _GraphValue<Self>,
6463
inputs: _ViewListInputs,
6564
body: @escaping (_Graph, _ViewListInputs) -> _ViewListOutputs
6665
) -> _ViewListOutputs
6766

6867
/// The number of views that `_makeViewList()` would produce, or
6968
/// nil if unknown.
70-
static func _viewListCount(
69+
nonisolated static func _viewListCount(
7170
inputs: _ViewListCountInputs,
7271
body: (_ViewListCountInputs) -> Int?
7372
) -> Int?
7473

75-
/// The content view type passed to `body()`.
76-
typealias Content = _ViewModifier_Content<Self>
74+
/// The type of view representing the body.
75+
associatedtype Body: View
7776

7877
/// Gets the current body of the caller.
7978
///
8079
/// `content` is a proxy for the view that will have the modifier
8180
/// represented by `Self` applied to it.
8281
@ViewBuilder
83-
@MainActor
84-
@preconcurrency
8582
func body(content: Content) -> Body
86-
}
87-
88-
extension ViewModifier {
89-
public static func _makeView(
90-
modifier: _GraphValue<Self>,
91-
inputs: _ViewInputs,
92-
body: @escaping (_Graph, _ViewInputs) -> _ViewOutputs
93-
) -> _ViewOutputs {
94-
makeView(modifier: modifier, inputs: inputs, body: body)
95-
}
9683

97-
public static func _makeViewList(
98-
modifier: _GraphValue<Self>,
99-
inputs: _ViewListInputs,
100-
body: @escaping (_Graph, _ViewListInputs) -> _ViewListOutputs
101-
) -> _ViewListOutputs {
102-
makeViewList(modifier: modifier, inputs: inputs, body: body)
103-
}
104-
105-
public static func _viewListCount(
106-
inputs: _ViewListCountInputs,
107-
body: (_ViewListCountInputs) -> Int?
108-
) -> Int? {
109-
viewListCount(inputs: inputs, body: body)
110-
}
84+
/// The content view type passed to `body()`.
85+
typealias Content = _ViewModifier_Content<Self>
11186
}
11287

88+
package protocol PrimitiveViewModifier: ViewModifier where Body == Never {}
89+
11390
extension ViewModifier where Body == Never {
11491
public func body(content _: Content) -> Never {
11592
bodyError()
@@ -163,3 +140,28 @@ extension ViewModifier {
163140
preconditionFailure("body() should not be called on \(Self.self)")
164141
}
165142
}
143+
144+
extension ViewModifier {
145+
public static func _makeView(
146+
modifier: _GraphValue<Self>,
147+
inputs: _ViewInputs,
148+
body: @escaping (_Graph, _ViewInputs) -> _ViewOutputs
149+
) -> _ViewOutputs {
150+
makeView(modifier: modifier, inputs: inputs, body: body)
151+
}
152+
153+
public static func _makeViewList(
154+
modifier: _GraphValue<Self>,
155+
inputs: _ViewListInputs,
156+
body: @escaping (_Graph, _ViewListInputs) -> _ViewListOutputs
157+
) -> _ViewListOutputs {
158+
makeViewList(modifier: modifier, inputs: inputs, body: body)
159+
}
160+
161+
public static func _viewListCount(
162+
inputs: _ViewListCountInputs,
163+
body: (_ViewListCountInputs) -> Int?
164+
) -> Int? {
165+
viewListCount(inputs: inputs, body: body)
166+
}
167+
}

0 commit comments

Comments
 (0)