Last active
April 11, 2021 13:53
-
-
Save thatswiftguy/518004d69f6c9ce7b6a4b6ba532ba044 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// | |
// TaskListView.swift | |
// TaskManager | |
// | |
// Created by Mohammad Yasir on 11/04/21. | |
// | |
import SwiftUI | |
struct TaskListView: View { | |
@ObservedObject var taskVM : TaskViewModel | |
var body: some View { | |
List { | |
ForEach (taskVM.tasks.filter { | |
self.taskVM.searched.isEmpty ? true : $0.name.localizedCapitalized.contains(self.taskVM.searched)} ){ task in | |
TaskView(task: task) | |
} | |
.onDelete(perform: { | |
taskVM.removeTask(indexAt: $0) | |
}) | |
}.listStyle(InsetListStyle()) | |
} | |
} | |
struct TaskListView_Previews: PreviewProvider { | |
static var previews: some View { | |
TaskListView(taskVM: TaskViewModel()) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment