Merge pull request #26 from PangMo5/PangMo5/apply-StateObject

Change some ObservedObject to StateObject
This commit is contained in:
aiden 2021-06-01 11:19:06 -04:00 committed by GitHub
commit 4f8d56b588
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -13,7 +13,7 @@ struct LibraryListView: View {
private var viewContext
@EnvironmentObject
var globalData: GlobalData
@ObservedObject
@StateObject
var viewModel: LibraryListViewModel
var body: some View {

View File

@ -15,7 +15,7 @@ struct LibrarySearchView: View {
private var viewContext
@EnvironmentObject
var globalData: GlobalData
@ObservedObject
@StateObject
var viewModel: LibrarySearchViewModel
@State

View File

@ -13,7 +13,7 @@ struct LibraryView: View {
private var viewContext
@EnvironmentObject
var globalData: GlobalData
@ObservedObject
@StateObject
var viewModel: LibraryViewModel
@State
@ -27,7 +27,7 @@ struct LibraryView: View {
private var tracks: [GridItem] = []
init(viewModel: LibraryViewModel, title: String) {
self.viewModel = viewModel
_viewModel = StateObject(wrappedValue: viewModel)
self.title = title
}