Created
November 19, 2023 21:11
-
-
Save colinfwren/a2e03e65010f91596d8887ad66080efa to your computer and use it in GitHub Desktop.
Date Test Content View
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
import SwiftUI | |
import SwiftData | |
struct ApproachContentView: View { | |
@State private var viewModel: ApproachViewModel | |
var body: some View { | |
NavigationStack { | |
List(viewModel.todoLists) { todoList in | |
Section(header: Text(todoList.title)) { | |
ForEach(todoList.todos) { todo in | |
Text(todo.title) | |
} | |
} | |
} | |
.navigationTitle("Approach Test") | |
.toolbar { | |
Button("Add Data", action: viewModel.addSamples) | |
} | |
} | |
} | |
init(modelContext: ModelContext) { | |
let viewModel = ApproachViewModel(modelContext: modelContext) | |
_viewModel = State(initialValue: viewModel) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment