@@ -2,6 +2,8 @@ import SwiftUI
2
2
3
3
/// An abstract representation of the `Table` type in SwiftUI, with any style.
4
4
///
5
+ /// ### iOS
6
+ ///
5
7
/// ```swift
6
8
/// struct ContentView: View {
7
9
/// struct Purchase: Identifiable {
@@ -20,26 +22,54 @@ import SwiftUI
20
22
/// TableColumn("With 20% tip") { purchase in
21
23
/// Text(purchase.price * 1.2, format: .currency(code: "USD"))
22
24
/// }
23
- /// TableColumn("With 25% tip") { purchase in
24
- /// Text(purchase.price * 1.25, format: .currency(code: "USD"))
25
- /// }
26
25
/// } rows: {
27
26
/// TableRow(Purchase(price: 20))
28
27
/// TableRow(Purchase(price: 50))
29
28
/// TableRow(Purchase(price: 75))
30
29
/// }
31
- /// #if os(iOS)
32
30
/// .introspect(.table, on: .iOS(.v16, .v17)) {
33
31
/// print(type(of: $0)) // UICollectionView
34
32
/// }
35
- /// #elseif os(macOS)
33
+ /// }
34
+ /// }
35
+ /// ```
36
+ ///
37
+ /// ### tvOS
38
+ ///
39
+ /// Not available.
40
+ ///
41
+ /// ### macOS
42
+ ///
43
+ /// ```swift
44
+ /// struct ContentView: View {
45
+ /// struct Purchase: Identifiable {
46
+ /// let id = UUID()
47
+ /// let price: Decimal
48
+ /// }
49
+ ///
50
+ /// var body: some View {
51
+ /// Table(of: Purchase.self) {
52
+ /// TableColumn("Base price") { purchase in
53
+ /// Text(purchase.price, format: .currency(code: "USD"))
54
+ /// }
55
+ /// TableColumn("With 15% tip") { purchase in
56
+ /// Text(purchase.price * 1.15, format: .currency(code: "USD"))
57
+ /// }
58
+ /// TableColumn("With 20% tip") { purchase in
59
+ /// Text(purchase.price * 1.2, format: .currency(code: "USD"))
60
+ /// }
61
+ /// } rows: {
62
+ /// TableRow(Purchase(price: 20))
63
+ /// TableRow(Purchase(price: 50))
64
+ /// TableRow(Purchase(price: 75))
65
+ /// }
36
66
/// .introspect(.table, on: .macOS(.v12, .v13, .v14)) {
37
67
/// print(type(of: $0)) // NSTableView
38
68
/// }
39
- /// #endif
40
69
/// }
41
70
/// }
42
71
/// ```
72
+ ///
43
73
public struct TableType : IntrospectableViewType { }
44
74
45
75
#if os(iOS) || os(macOS)
0 commit comments