diff --git a/apple/OmnivoreKit/Sources/Binders/RootViewModel.swift b/apple/OmnivoreKit/Sources/Binders/RootViewModel.swift index 18f7fcb3f..f64616d46 100644 --- a/apple/OmnivoreKit/Sources/Binders/RootViewModel.swift +++ b/apple/OmnivoreKit/Sources/Binders/RootViewModel.swift @@ -118,8 +118,6 @@ public struct RootView: View { @ObservedObject private var viewModel: RootViewModel @ObservedObject private var authenticator: Authenticator - private var primaryViewModel: PrimaryContentViewModel - public init( pdfViewerProvider: ((URL, PDFViewerViewModel) -> AnyView)?, intercomProvider: IntercomProvider? @@ -127,7 +125,6 @@ public struct RootView: View { let rootViewModel = RootViewModel() self.viewModel = rootViewModel self.authenticator = rootViewModel.services.authenticator - self.primaryViewModel = PrimaryContentViewModel(services: rootViewModel.services) #if DEBUG if CommandLine.arguments.contains("--uitesting") { @@ -148,7 +145,7 @@ public struct RootView: View { @ViewBuilder private var innerBody: some View { if authenticator.isLoggedIn { - PrimaryContentView(viewModel: primaryViewModel) + PrimaryContentView(services: viewModel.services) .onAppear { viewModel.triggerPushNotificationRequestIfNeeded() } diff --git a/apple/OmnivoreKit/Sources/Binders/Views/PrimaryContentView.swift b/apple/OmnivoreKit/Sources/Binders/Views/PrimaryContentView.swift index 103f6f355..3c6fa23be 100644 --- a/apple/OmnivoreKit/Sources/Binders/Views/PrimaryContentView.swift +++ b/apple/OmnivoreKit/Sources/Binders/Views/PrimaryContentView.swift @@ -3,7 +3,7 @@ import Services import SwiftUI import Views -public final class PrimaryContentViewModel { +public struct PrimaryContentView: View { let homeFeedViewModel: HomeFeedViewModel let profileContainerViewModel: ProfileContainerViewModel @@ -11,14 +11,6 @@ public final class PrimaryContentViewModel { self.homeFeedViewModel = HomeFeedViewModel.make(services: services) self.profileContainerViewModel = ProfileContainerViewModel.make(services: services) } -} - -public struct PrimaryContentView: View { - private let viewModel: PrimaryContentViewModel - - public init(viewModel: PrimaryContentViewModel) { - self.viewModel = viewModel - } public var body: some View { #if os(iOS) @@ -34,14 +26,14 @@ public struct PrimaryContentView: View { // iphone view container private var compactView: some View { - HomeFeedView(viewModel: viewModel.homeFeedViewModel) + HomeFeedView(viewModel: homeFeedViewModel) } // ipad and mac view container private var regularView: some View { let categories = [ - PrimaryContentCategory.feed(viewModel: viewModel.homeFeedViewModel), - PrimaryContentCategory.profile(viewModel: viewModel.profileContainerViewModel) + PrimaryContentCategory.feed(viewModel: homeFeedViewModel), + PrimaryContentCategory.profile(viewModel: profileContainerViewModel) ] return NavigationView {