|
1 | 1 | #if canImport(SwiftUI)
|
2 | 2 | import SwiftUI
|
3 |
| - @_spi(RuntimeWarn) import SwiftUINavigationCore |
| 3 | + import IssueReporting |
4 | 4 |
|
5 | 5 | // NB: Deprecated after 1.3.0
|
6 | 6 |
|
|
862 | 862 |
|
863 | 863 | public init<Case1: Sendable, Content1>(
|
864 | 864 | _ enum: Binding<Enum>,
|
865 |
| - file: StaticString = #fileID, |
| 865 | + fileID: StaticString = #fileID, |
| 866 | + filePath: StaticString = #filePath, |
866 | 867 | line: UInt = #line,
|
| 868 | + column: UInt = #column, |
867 | 869 | @ViewBuilder content: () -> CaseLet<Enum, Case1, Content1>
|
868 | 870 | )
|
869 | 871 | where
|
|
874 | 876 | {
|
875 | 877 | self.init(`enum`) {
|
876 | 878 | content()
|
877 |
| - Default { _ExhaustivityCheckView<Enum>(file: file, line: line) } |
| 879 | + Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) } |
878 | 880 | }
|
879 | 881 | }
|
880 | 882 |
|
|
911 | 913 |
|
912 | 914 | public init<Case1: Sendable, Content1, Case2: Sendable, Content2>(
|
913 | 915 | _ enum: Binding<Enum>,
|
914 |
| - file: StaticString = #fileID, |
| 916 | + fileID: StaticString = #fileID, |
| 917 | + filePath: StaticString = #filePath, |
915 | 918 | line: UInt = #line,
|
| 919 | + column: UInt = #column, |
916 | 920 | @ViewBuilder content: () -> TupleView<
|
917 | 921 | (
|
918 | 922 | CaseLet<Enum, Case1, Content1>,
|
|
933 | 937 | self.init(`enum`) {
|
934 | 938 | content.value.0
|
935 | 939 | content.value.1
|
936 |
| - Default { _ExhaustivityCheckView<Enum>(file: file, line: line) } |
| 940 | + Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) } |
937 | 941 | }
|
938 | 942 | }
|
939 | 943 |
|
|
981 | 985 |
|
982 | 986 | public init<Case1: Sendable, Content1, Case2: Sendable, Content2, Case3: Sendable, Content3>(
|
983 | 987 | _ enum: Binding<Enum>,
|
984 |
| - file: StaticString = #fileID, |
| 988 | + fileID: StaticString = #fileID, |
| 989 | + filePath: StaticString = #filePath, |
985 | 990 | line: UInt = #line,
|
| 991 | + column: UInt = #column, |
986 | 992 | @ViewBuilder content: () -> TupleView<
|
987 | 993 | (
|
988 | 994 | CaseLet<Enum, Case1, Content1>,
|
|
1008 | 1014 | content.value.0
|
1009 | 1015 | content.value.1
|
1010 | 1016 | content.value.2
|
1011 |
| - Default { _ExhaustivityCheckView<Enum>(file: file, line: line) } |
| 1017 | + Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) } |
1012 | 1018 | }
|
1013 | 1019 | }
|
1014 | 1020 |
|
|
1068 | 1074 | Case4: Sendable, Content4
|
1069 | 1075 | >(
|
1070 | 1076 | _ enum: Binding<Enum>,
|
1071 |
| - file: StaticString = #fileID, |
| 1077 | + fileID: StaticString = #fileID, |
| 1078 | + filePath: StaticString = #filePath, |
1072 | 1079 | line: UInt = #line,
|
| 1080 | + column: UInt = #column, |
1073 | 1081 | @ViewBuilder content: () -> TupleView<
|
1074 | 1082 | (
|
1075 | 1083 | CaseLet<Enum, Case1, Content1>,
|
|
1100 | 1108 | content.value.1
|
1101 | 1109 | content.value.2
|
1102 | 1110 | content.value.3
|
1103 |
| - Default { _ExhaustivityCheckView<Enum>(file: file, line: line) } |
| 1111 | + Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) } |
1104 | 1112 | }
|
1105 | 1113 | }
|
1106 | 1114 |
|
|
1168 | 1176 | Case5: Sendable, Content5
|
1169 | 1177 | >(
|
1170 | 1178 | _ enum: Binding<Enum>,
|
1171 |
| - file: StaticString = #fileID, |
| 1179 | + fileID: StaticString = #fileID, |
| 1180 | + filePath: StaticString = #filePath, |
1172 | 1181 | line: UInt = #line,
|
| 1182 | + column: UInt = #column, |
1173 | 1183 | @ViewBuilder content: () -> TupleView<
|
1174 | 1184 | (
|
1175 | 1185 | CaseLet<Enum, Case1, Content1>,
|
|
1205 | 1215 | content.value.2
|
1206 | 1216 | content.value.3
|
1207 | 1217 | content.value.4
|
1208 |
| - Default { _ExhaustivityCheckView<Enum>(file: file, line: line) } |
| 1218 | + Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) } |
1209 | 1219 | }
|
1210 | 1220 | }
|
1211 | 1221 |
|
|
1281 | 1291 | Case6: Sendable, Content6
|
1282 | 1292 | >(
|
1283 | 1293 | _ enum: Binding<Enum>,
|
1284 |
| - file: StaticString = #fileID, |
| 1294 | + fileID: StaticString = #fileID, |
| 1295 | + filePath: StaticString = #filePath, |
1285 | 1296 | line: UInt = #line,
|
| 1297 | + column: UInt = #column, |
1286 | 1298 | @ViewBuilder content: () -> TupleView<
|
1287 | 1299 | (
|
1288 | 1300 | CaseLet<Enum, Case1, Content1>,
|
|
1323 | 1335 | content.value.3
|
1324 | 1336 | content.value.4
|
1325 | 1337 | content.value.5
|
1326 |
| - Default { _ExhaustivityCheckView<Enum>(file: file, line: line) } |
| 1338 | + Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) } |
1327 | 1339 | }
|
1328 | 1340 | }
|
1329 | 1341 |
|
|
1407 | 1419 | Case7: Sendable, Content7
|
1408 | 1420 | >(
|
1409 | 1421 | _ enum: Binding<Enum>,
|
1410 |
| - file: StaticString = #fileID, |
| 1422 | + fileID: StaticString = #fileID, |
| 1423 | + filePath: StaticString = #filePath, |
1411 | 1424 | line: UInt = #line,
|
| 1425 | + column: UInt = #column, |
1412 | 1426 | @ViewBuilder content: () -> TupleView<
|
1413 | 1427 | (
|
1414 | 1428 | CaseLet<Enum, Case1, Content1>,
|
|
1454 | 1468 | content.value.4
|
1455 | 1469 | content.value.5
|
1456 | 1470 | content.value.6
|
1457 |
| - Default { _ExhaustivityCheckView<Enum>(file: file, line: line) } |
| 1471 | + Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) } |
1458 | 1472 | }
|
1459 | 1473 | }
|
1460 | 1474 |
|
|
1546 | 1560 | Case8: Sendable, Content8
|
1547 | 1561 | >(
|
1548 | 1562 | _ enum: Binding<Enum>,
|
1549 |
| - file: StaticString = #fileID, |
| 1563 | + fileID: StaticString = #fileID, |
| 1564 | + filePath: StaticString = #filePath, |
1550 | 1565 | line: UInt = #line,
|
| 1566 | + column: UInt = #column, |
1551 | 1567 | @ViewBuilder content: () -> TupleView<
|
1552 | 1568 | (
|
1553 | 1569 | CaseLet<Enum, Case1, Content1>,
|
|
1598 | 1614 | content.value.5
|
1599 | 1615 | content.value.6
|
1600 | 1616 | content.value.7
|
1601 |
| - Default { _ExhaustivityCheckView<Enum>(file: file, line: line) } |
| 1617 | + Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) } |
1602 | 1618 | }
|
1603 | 1619 | }
|
1604 | 1620 |
|
|
1698 | 1714 | Case9: Sendable, Content9
|
1699 | 1715 | >(
|
1700 | 1716 | _ enum: Binding<Enum>,
|
1701 |
| - file: StaticString = #fileID, |
| 1717 | + fileID: StaticString = #fileID, |
| 1718 | + filePath: StaticString = #filePath, |
1702 | 1719 | line: UInt = #line,
|
| 1720 | + column: UInt = #column, |
1703 | 1721 | @ViewBuilder content: () -> TupleView<
|
1704 | 1722 | (
|
1705 | 1723 | CaseLet<Enum, Case1, Content1>,
|
|
1755 | 1773 | content.value.6
|
1756 | 1774 | content.value.7
|
1757 | 1775 | content.value.8
|
1758 |
| - Default { _ExhaustivityCheckView<Enum>(file: file, line: line) } |
| 1776 | + Default { _ExhaustivityCheckView<Enum>(fileID: fileID, filePath: filePath, line: line, column: column) } |
1759 | 1777 | }
|
1760 | 1778 | }
|
1761 | 1779 | }
|
1762 | 1780 |
|
1763 | 1781 | public struct _ExhaustivityCheckView<Enum>: View {
|
1764 | 1782 | @EnvironmentObject private var `enum`: BindingObject<Enum>
|
1765 |
| - let file: StaticString |
| 1783 | + let fileID: StaticString |
| 1784 | + let filePath: StaticString |
1766 | 1785 | let line: UInt
|
| 1786 | + let column: UInt |
1767 | 1787 |
|
1768 | 1788 | public var body: some View {
|
1769 | 1789 | #if DEBUG
|
1770 | 1790 | let message = """
|
1771 |
| - Warning: Switch.body@\(self.file):\(self.line) |
| 1791 | + Warning: Switch.body@\(self.fileID):\(self.line) |
1772 | 1792 |
|
1773 | 1793 | "Switch" did not handle "\(describeCase(self.enum.wrappedValue.wrappedValue))"
|
1774 | 1794 |
|
|
1785 | 1805 | .foregroundColor(.white)
|
1786 | 1806 | .padding()
|
1787 | 1807 | .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 | + } |
1789 | 1811 | #else
|
1790 | 1812 | EmptyView()
|
1791 | 1813 | #endif
|
|
0 commit comments