1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import SwiftUI
struct ContentListRowStyle: ViewModifier {
var openPost: (() -> Void)?
var contentInsets = EdgeInsets(top: 20, leading: 16, bottom: 16, trailing: 16)
var showsSeparator = true
@Environment(\.colorScheme) private var colorScheme
@Environment(\.displayScale) private var displayScale
private var isPad: Bool { UIDevice.current.userInterfaceIdiom == .pad }
func body(content: Content) -> some View {
content
.modifier(PostNavigationPadding(insets: contentInsets, action: openPost))
.frame(maxWidth: .infinity, alignment: .leading)
.modifier(PostNavigationTarget(action: openPost, isAccessible: false))
.background(Color(uiColor: .systemBackground))
.overlay(alignment: .bottom) {
if showsSeparator && isPad && colorScheme == .dark {
Color(uiColor: .separator)
.frame(height: 1 / displayScale)
.accessibilityHidden(true)
}
}
.padding(.bottom, showsSeparator ? (isPad ? 12 : 8) : 0)
.background(Color(uiColor: .secondarySystemBackground))
}
}