Restrict swipe actions to iOS

This commit is contained in:
Arkadiusz Fal
2026-04-20 21:13:08 +02:00
parent bb9ec2fc2a
commit b0f9bb2229
4 changed files with 16 additions and 6 deletions

View File

@@ -7,14 +7,22 @@
import SwiftUI
#if os(tvOS)
#if !os(iOS)
extension View {
/// On tvOS, swipe actions are not supported - returns the view unmodified.
/// Swipe actions are iOS-only; on macOS/tvOS this returns the view unmodified.
@ViewBuilder
func swipeActions(
config: SwipeActionConfig = .init(),
@SwipeActionBuilder actions: () -> [SwipeAction]
config _: SwipeActionConfig = .init(),
@SwipeActionBuilder actions _: () -> [SwipeAction]
) -> some View {
self
}
@ViewBuilder
func swipeActions(
config _: SwipeActionConfig = .init(),
actionsArray _: [SwipeAction]
) -> some View {
self
}

View File

@@ -67,7 +67,7 @@ struct QueueItemRow: View {
.contentShape(Rectangle())
}
.buttonStyle(.plain)
#if !os(tvOS)
#if os(iOS)
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
Button(role: .destructive) {
onRemove()

View File

@@ -196,11 +196,13 @@ private struct VideoActionsSection: View {
}
}
#if os(iOS)
NavigationLink {
SwipeActionsSettingsView()
} label: {
Label(String(localized: "settings.appearance.swipeActions"), systemImage: "hand.draw")
}
#endif
} header: {
Text(String(localized: "settings.videoActions.header"))
}

View File

@@ -380,7 +380,7 @@ private struct PresetRow: View {
.contentShape(Rectangle())
}
.buttonStyle(.plain)
#if !os(tvOS)
#if os(iOS)
.swipeActions(edge: .trailing, allowsFullSwipe: false) {
if let onDelete, !preset.isBuiltIn, canDelete {
Button(role: .destructive) {