Skip to content

Commit 0258cf3

Browse files
committed
wip
1 parent 8e965fe commit 0258cf3

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

Sources/ViewTypes/Table.swift

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import SwiftUI
22

33
/// An abstract representation of the `Table` type in SwiftUI, with any style.
44
///
5+
/// ### iOS
6+
///
57
/// ```swift
68
/// struct ContentView: View {
79
/// struct Purchase: Identifiable {
@@ -20,26 +22,54 @@ import SwiftUI
2022
/// TableColumn("With 20% tip") { purchase in
2123
/// Text(purchase.price * 1.2, format: .currency(code: "USD"))
2224
/// }
23-
/// TableColumn("With 25% tip") { purchase in
24-
/// Text(purchase.price * 1.25, format: .currency(code: "USD"))
25-
/// }
2625
/// } rows: {
2726
/// TableRow(Purchase(price: 20))
2827
/// TableRow(Purchase(price: 50))
2928
/// TableRow(Purchase(price: 75))
3029
/// }
31-
/// #if os(iOS)
3230
/// .introspect(.table, on: .iOS(.v16, .v17)) {
3331
/// print(type(of: $0)) // UICollectionView
3432
/// }
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+
/// }
3666
/// .introspect(.table, on: .macOS(.v12, .v13, .v14)) {
3767
/// print(type(of: $0)) // NSTableView
3868
/// }
39-
/// #endif
4069
/// }
4170
/// }
4271
/// ```
72+
///
4373
public struct TableType: IntrospectableViewType {}
4474

4575
#if os(iOS) || os(macOS)

0 commit comments

Comments
 (0)