Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions Sources/SkipUI/SkipUI/Containers/List.swift
Original file line number Diff line number Diff line change
Expand Up @@ -640,18 +640,21 @@ public final class List : View, Renderable {
}
let trailingButtonsRaw: kotlin.collections.List<Button> = trailingButtonsRawMutable
let leadingButtonsRaw: kotlin.collections.List<Button> = leadingButtonsRawMutable
/* iOS reorders .destructive Buttons to the swipe-from edge regardless
of the order they were declared in. For trailing swipes that means
pinned to the right (last in the Row laid out with Arrangement.End);
for leading, pinned to the left (first with Arrangement.Start). The
destructive button also becomes the full-swipe target. */
/* iOS displays trailing swipe actions in the opposite visual order from
their declaration so the first declared action sits on the swipe edge.
Leading actions keep declaration order. iOS also reorders .destructive
Buttons to the swipe-from edge regardless of declaration order. For
trailing swipes that means pinned to the right (last in the Row laid
out with Arrangement.End); for leading, pinned to the left (first with
Arrangement.Start). The destructive button also becomes the full-swipe
target. */
let trailingDestructive = trailingButtonsRaw.firstOrNull { $0.role == ButtonRole.destructive }
let trailingNonDestructive = trailingButtonsRaw.filter { $0.role != ButtonRole.destructive }
let trailingButtons: kotlin.collections.List<Button>
if let trailingDestructive {
trailingButtons = (trailingNonDestructive + listOf(trailingDestructive))
trailingButtons = (trailingNonDestructive.reversed() + listOf(trailingDestructive))
} else {
trailingButtons = trailingButtonsRaw
trailingButtons = trailingButtonsRaw.reversed()
}
let leadingDestructive = leadingButtonsRaw.firstOrNull { $0.role == ButtonRole.destructive }
let leadingNonDestructive = leadingButtonsRaw.filter { $0.role != ButtonRole.destructive }
Expand Down
Loading