Convert YouTube Enhancements settings to macOS-native helpers

Includes SponsorBlock, Return YouTube Dislike, and DeArrow sub-screens.
Extend SettingsNavigationRow with an optional trailing content slot so
rows can show enabled/disabled status next to the chevron.
This commit is contained in:
Arkadiusz Fal
2026-04-21 00:31:04 +02:00
parent 60be0f8b53
commit f173dd1c39
5 changed files with 47 additions and 66 deletions

View File

@@ -139,18 +139,21 @@ struct SettingsFormSection<Content: View>: View {
/// On macOS it renders as a plain full-width list row with a trailing
/// chevron, matching the native macOS System Settings look. On iOS/tvOS
/// it renders as a standard `NavigationLink` with a `Label`.
struct SettingsNavigationRow<Destination: View>: View {
struct SettingsNavigationRow<Destination: View, Trailing: View>: View {
let titleKey: LocalizedStringKey
let systemImage: String
@ViewBuilder var trailing: () -> Trailing
@ViewBuilder var destination: () -> Destination
init(
_ titleKey: LocalizedStringKey,
systemImage: String,
@ViewBuilder trailing: @escaping () -> Trailing = { EmptyView() },
@ViewBuilder destination: @escaping () -> Destination
) {
self.titleKey = titleKey
self.systemImage = systemImage
self.trailing = trailing
self.destination = destination
}
@@ -162,6 +165,8 @@ struct SettingsNavigationRow<Destination: View>: View {
HStack(spacing: 8) {
Label(titleKey, systemImage: systemImage)
Spacer()
trailing()
.foregroundStyle(.secondary)
Image(systemName: "chevron.right")
.font(.caption)
.foregroundStyle(.tertiary)
@@ -169,7 +174,12 @@ struct SettingsNavigationRow<Destination: View>: View {
.frame(maxWidth: .infinity, alignment: .leading)
.contentShape(Rectangle())
#else
Label(titleKey, systemImage: systemImage)
HStack {
Label(titleKey, systemImage: systemImage)
Spacer()
trailing()
.foregroundStyle(.secondary)
}
#endif
}
#if os(macOS)