Skip to content

Commit b764871

Browse files
committed
Moving things over to IssueReporting.
1 parent 2a9882c commit b764871

File tree

9 files changed

+60
-119
lines changed

9 files changed

+60
-119
lines changed

Package.resolved

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let package = Package(
2424
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
2525
.package(url: "https://github.com/pointfreeco/swift-case-paths", from: "1.2.2"),
2626
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.0.0"),
27-
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.0.0"),
27+
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", branch: "swift-testing"),
2828
],
2929
targets: [
3030
.target(
@@ -44,7 +44,7 @@ let package = Package(
4444
name: "SwiftUINavigationCore",
4545
dependencies: [
4646
.product(name: "CustomDump", package: "swift-custom-dump"),
47-
.product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay"),
47+
.product(name: "IssueReporting", package: "xctest-dynamic-overlay"),
4848
]
4949
),
5050
]

[email protected]

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let package = Package(
2424
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
2525
.package(url: "https://github.com/pointfreeco/swift-case-paths", from: "1.2.2"),
2626
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.0.0"),
27-
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.0.0"),
27+
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", branch: "swift-testing"),
2828
],
2929
targets: [
3030
.target(
@@ -44,7 +44,7 @@ let package = Package(
4444
name: "SwiftUINavigationCore",
4545
dependencies: [
4646
.product(name: "CustomDump", package: "swift-custom-dump"),
47-
.product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay"),
47+
.product(name: "IssueReporting", package: "xctest-dynamic-overlay"),
4848
]
4949
),
5050
],

Sources/SwiftUINavigation/Internal/Deprecations.swift

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#if canImport(SwiftUI)
22
import SwiftUI
3-
@_spi(RuntimeWarn) import SwiftUINavigationCore
3+
import IssueReporting
44

55
// NB: Deprecated after 1.3.0
66

@@ -862,8 +862,10 @@
862862

863863
public init<Case1: Sendable, Content1>(
864864
_ enum: Binding<Enum>,
865-
file: StaticString = #fileID,
865+
fileID: StaticString = #fileID,
866+
filePath: StaticString = #filePath,
866867
line: UInt = #line,
868+
column: UInt = #column,
867869
@ViewBuilder content: () -> CaseLet<Enum, Case1, Content1>
868870
)
869871
where
@@ -874,7 +876,7 @@
874876
{
875877
self.init(`enum`) {
876878
content()
877-
Default { _ExhaustivityCheckView<Enum>(file: file, line: line) }
879+
Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) }
878880
}
879881
}
880882

@@ -911,8 +913,10 @@
911913

912914
public init<Case1: Sendable, Content1, Case2: Sendable, Content2>(
913915
_ enum: Binding<Enum>,
914-
file: StaticString = #fileID,
916+
fileID: StaticString = #fileID,
917+
filePath: StaticString = #filePath,
915918
line: UInt = #line,
919+
column: UInt = #column,
916920
@ViewBuilder content: () -> TupleView<
917921
(
918922
CaseLet<Enum, Case1, Content1>,
@@ -933,7 +937,7 @@
933937
self.init(`enum`) {
934938
content.value.0
935939
content.value.1
936-
Default { _ExhaustivityCheckView<Enum>(file: file, line: line) }
940+
Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) }
937941
}
938942
}
939943

@@ -981,8 +985,10 @@
981985

982986
public init<Case1: Sendable, Content1, Case2: Sendable, Content2, Case3: Sendable, Content3>(
983987
_ enum: Binding<Enum>,
984-
file: StaticString = #fileID,
988+
fileID: StaticString = #fileID,
989+
filePath: StaticString = #filePath,
985990
line: UInt = #line,
991+
column: UInt = #column,
986992
@ViewBuilder content: () -> TupleView<
987993
(
988994
CaseLet<Enum, Case1, Content1>,
@@ -1008,7 +1014,7 @@
10081014
content.value.0
10091015
content.value.1
10101016
content.value.2
1011-
Default { _ExhaustivityCheckView<Enum>(file: file, line: line) }
1017+
Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) }
10121018
}
10131019
}
10141020

@@ -1068,8 +1074,10 @@
10681074
Case4: Sendable, Content4
10691075
>(
10701076
_ enum: Binding<Enum>,
1071-
file: StaticString = #fileID,
1077+
fileID: StaticString = #fileID,
1078+
filePath: StaticString = #filePath,
10721079
line: UInt = #line,
1080+
column: UInt = #column,
10731081
@ViewBuilder content: () -> TupleView<
10741082
(
10751083
CaseLet<Enum, Case1, Content1>,
@@ -1100,7 +1108,7 @@
11001108
content.value.1
11011109
content.value.2
11021110
content.value.3
1103-
Default { _ExhaustivityCheckView<Enum>(file: file, line: line) }
1111+
Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) }
11041112
}
11051113
}
11061114

@@ -1168,8 +1176,10 @@
11681176
Case5: Sendable, Content5
11691177
>(
11701178
_ enum: Binding<Enum>,
1171-
file: StaticString = #fileID,
1179+
fileID: StaticString = #fileID,
1180+
filePath: StaticString = #filePath,
11721181
line: UInt = #line,
1182+
column: UInt = #column,
11731183
@ViewBuilder content: () -> TupleView<
11741184
(
11751185
CaseLet<Enum, Case1, Content1>,
@@ -1205,7 +1215,7 @@
12051215
content.value.2
12061216
content.value.3
12071217
content.value.4
1208-
Default { _ExhaustivityCheckView<Enum>(file: file, line: line) }
1218+
Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) }
12091219
}
12101220
}
12111221

@@ -1281,8 +1291,10 @@
12811291
Case6: Sendable, Content6
12821292
>(
12831293
_ enum: Binding<Enum>,
1284-
file: StaticString = #fileID,
1294+
fileID: StaticString = #fileID,
1295+
filePath: StaticString = #filePath,
12851296
line: UInt = #line,
1297+
column: UInt = #column,
12861298
@ViewBuilder content: () -> TupleView<
12871299
(
12881300
CaseLet<Enum, Case1, Content1>,
@@ -1323,7 +1335,7 @@
13231335
content.value.3
13241336
content.value.4
13251337
content.value.5
1326-
Default { _ExhaustivityCheckView<Enum>(file: file, line: line) }
1338+
Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) }
13271339
}
13281340
}
13291341

@@ -1407,8 +1419,10 @@
14071419
Case7: Sendable, Content7
14081420
>(
14091421
_ enum: Binding<Enum>,
1410-
file: StaticString = #fileID,
1422+
fileID: StaticString = #fileID,
1423+
filePath: StaticString = #filePath,
14111424
line: UInt = #line,
1425+
column: UInt = #column,
14121426
@ViewBuilder content: () -> TupleView<
14131427
(
14141428
CaseLet<Enum, Case1, Content1>,
@@ -1454,7 +1468,7 @@
14541468
content.value.4
14551469
content.value.5
14561470
content.value.6
1457-
Default { _ExhaustivityCheckView<Enum>(file: file, line: line) }
1471+
Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) }
14581472
}
14591473
}
14601474

@@ -1546,8 +1560,10 @@
15461560
Case8: Sendable, Content8
15471561
>(
15481562
_ enum: Binding<Enum>,
1549-
file: StaticString = #fileID,
1563+
fileID: StaticString = #fileID,
1564+
filePath: StaticString = #filePath,
15501565
line: UInt = #line,
1566+
column: UInt = #column,
15511567
@ViewBuilder content: () -> TupleView<
15521568
(
15531569
CaseLet<Enum, Case1, Content1>,
@@ -1598,7 +1614,7 @@
15981614
content.value.5
15991615
content.value.6
16001616
content.value.7
1601-
Default { _ExhaustivityCheckView<Enum>(file: file, line: line) }
1617+
Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) }
16021618
}
16031619
}
16041620

@@ -1698,8 +1714,10 @@
16981714
Case9: Sendable, Content9
16991715
>(
17001716
_ enum: Binding<Enum>,
1701-
file: StaticString = #fileID,
1717+
fileID: StaticString = #fileID,
1718+
filePath: StaticString = #filePath,
17021719
line: UInt = #line,
1720+
column: UInt = #column,
17031721
@ViewBuilder content: () -> TupleView<
17041722
(
17051723
CaseLet<Enum, Case1, Content1>,
@@ -1755,20 +1773,22 @@
17551773
content.value.6
17561774
content.value.7
17571775
content.value.8
1758-
Default { _ExhaustivityCheckView<Enum>(file: file, line: line) }
1776+
Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) }
17591777
}
17601778
}
17611779
}
17621780

17631781
public struct _ExhaustivityCheckView<Enum>: View {
17641782
@EnvironmentObject private var `enum`: BindingObject<Enum>
1765-
let file: StaticString
1783+
let fileID: StaticString
1784+
let filePath: StaticString
17661785
let line: UInt
1786+
let column: UInt
17671787

17681788
public var body: some View {
17691789
#if DEBUG
17701790
let message = """
1771-
Warning: Switch.body@\(self.file):\(self.line)
1791+
Warning: Switch.body@\(self.fileID):\(self.line)
17721792
17731793
"Switch" did not handle "\(describeCase(self.enum.wrappedValue.wrappedValue))"
17741794
@@ -1785,7 +1805,9 @@
17851805
.foregroundColor(.white)
17861806
.padding()
17871807
.background(Color.red.edgesIgnoringSafeArea(.all))
1788-
.onAppear { runtimeWarn(message, file: self.file, line: self.line) }
1808+
.onAppear {
1809+
reportIssue(message, fileID: fileID, filePath: filePath, line: line, column: column)
1810+
}
17891811
#else
17901812
EmptyView()
17911813
#endif

Sources/SwiftUINavigationCore/ButtonState.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#if canImport(SwiftUI)
22
import CustomDump
3+
import IssueReporting
34
import SwiftUI
45

56
public struct ButtonState<Action>: Identifiable {
@@ -72,14 +73,15 @@
7273
/// > animated, a runtime warning will be emitted.
7374
///
7475
/// - Parameter perform: Unwraps and passes a button's action to a closure to be performed.
75-
public func withAction(_ perform: (Action?) async -> Void) async {
76+
@MainActor
77+
public func withAction(_ perform: @MainActor (Action?) async -> Void) async {
7678
switch self.action.type {
7779
case let .send(action):
7880
await perform(action)
7981
case let .animatedSend(action, _):
8082
var output = ""
8183
customDump(self.action, to: &output, indent: 4)
82-
runtimeWarn(
84+
reportIssue(
8385
"""
8486
An animated action was performed asynchronously: …
8587

Sources/SwiftUINavigationCore/Internal/RuntimeWarnings.swift

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

Tests/SwiftUINavigationTests/BindingTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
extension Binding {
5555
fileprivate init(initialValue: Value) {
56-
var value = initialValue
56+
nonisolated(unsafe) var value = initialValue
5757
self.init(
5858
get: { value },
5959
set: { value = $0 }

0 commit comments

Comments
 (0)