To remove the separator there are many answers provided here that work.
But to adjust the separator insets on iOS 15 or older I have a workaround (SwiftUI doesn't provide a mean to do this).
Right padding:
As @user1664018 said:
.padding(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 20))
Left padding:
Simply add Text("")
view to your cell with padding being same of desired separator inset! See below a layout given as example.
Explanation: SwiftUI draws the separator aligned with the first Text element. Simple. So the leftmost Text view will decide where the separator will start.
Example:
var body: some View {
VStack(spacing: 0) {
HStack(spacing: 0) {
// This is necesary so that the separator starts from the edge
Text("")
Image("colored.waved.illustration")
VStack(alignment: .leading) {
Text(notification.title)
Text(notification.description)
}
}
.frame(height: height)
}
}