We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 16c7460 commit 0403bb6Copy full SHA for 0403bb6
Sources/NorthwindSwiftUI/ProductsList.swift
@@ -17,7 +17,9 @@ struct ProductsList: View {
17
/// The current search string.
18
@State private var searchString = ""
19
20
+ #if !os(macOS)
21
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
22
+ #endif
23
24
var body: some View {
25
List(products, selection: $selectedProduct) { product in
@@ -35,12 +37,14 @@ struct ProductsList: View {
35
37
)
36
38
}
39
40
41
if horizontalSizeClass != .compact {
42
// Pre-select the first match if none is selected
43
if selectedProduct == nil, let product = products.first {
44
selectedProduct = product.id
45
46
47
48
49
catch { // really, do proper error handling :-)
50
print("Fetch failed:", error)
0 commit comments