This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import Combine | |
struct ContentView: View { | |
@ObservedObject var vm = ContentViewModel() | |
var body: some View { | |
List { | |
Section(header: Text("Check False")) { | |
ForEach(vm.items.filter { $0.check == false }) { item in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TodoListSideMenuViewModel: ObservableObject { | |
@Published var darkModeModel = DarkModeModel() | |
@Published var darkModeSystemName: String = "" | |
private var bag = Set<AnyCancellable>() | |
init() { | |
self.darkModeModel.$isDark.sink(receiveValue: { [weak self] isDark in | |
self?.darkModeSystemName = isDark ? "moon.fill" : "sun.max.fill" | |
}).store(in: &bag) | |
} |