From c23b42f76cfaf3d2732989a8db31a88d08efe0d8 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sun, 14 Aug 2022 19:02:36 +0200 Subject: [PATCH] Add disable for multiselect row --- Shared/Settings/MultiselectRow.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Shared/Settings/MultiselectRow.swift b/Shared/Settings/MultiselectRow.swift index 59cf1002..2b6784cc 100644 --- a/Shared/Settings/MultiselectRow.swift +++ b/Shared/Settings/MultiselectRow.swift @@ -2,7 +2,8 @@ import SwiftUI struct MultiselectRow: View { let title: String - let selected: Bool + var selected: Bool + var disabled = false var action: (Bool) -> Void @State private var toggleChecked = false @@ -16,6 +17,7 @@ struct MultiselectRow: View { Spacer() } .onAppear { + guard !disabled else { return } toggleChecked = selected } .onChange(of: toggleChecked) { new in @@ -34,8 +36,9 @@ struct MultiselectRow: View { } .contentShape(Rectangle()) } + .disabled(disabled) #if !os(tvOS) - .buttonStyle(.plain) + .buttonStyle(.plain) #endif } }