diff --git a/apple/OmnivoreKit/Sources/Binders/Scenes/PrimaryContentScene.swift b/apple/OmnivoreKit/Sources/Binders/Scenes/PrimaryContentScene.swift index 2b30e926d..1dfe9b3fb 100644 --- a/apple/OmnivoreKit/Sources/Binders/Scenes/PrimaryContentScene.swift +++ b/apple/OmnivoreKit/Sources/Binders/Scenes/PrimaryContentScene.swift @@ -4,21 +4,9 @@ import Views extension PrimaryContentViewModel { static func make(services: Services) -> PrimaryContentViewModel { - let viewModel = PrimaryContentViewModel( + PrimaryContentViewModel( homeFeedViewModel: HomeFeedViewModel.make(services: services), profileContainerViewModel: ProfileContainerViewModel.make(services: services) ) - viewModel.bind(services: services) - return viewModel - } - - func bind(services _: Services) { - performActionSubject.sink { action in - switch action { - case .nothing: - break - } - } - .store(in: &subscriptions) } } diff --git a/apple/OmnivoreKit/Sources/Views/PrimaryContainerViews/PrimaryContentCategory.swift b/apple/OmnivoreKit/Sources/Views/PrimaryContainerViews/PrimaryContentCategory.swift index 0b08f0c3b..822cea342 100644 --- a/apple/OmnivoreKit/Sources/Views/PrimaryContainerViews/PrimaryContentCategory.swift +++ b/apple/OmnivoreKit/Sources/Views/PrimaryContainerViews/PrimaryContentCategory.swift @@ -56,20 +56,3 @@ enum PrimaryContentCategory: Identifiable, Hashable, Equatable { hasher.combine(id) } } - -struct TabIcon: View { - let isSelected: Bool - let primaryContentCategory: PrimaryContentCategory - - var body: some View { - if isSelected { - Label { - Text(primaryContentCategory.title) - } icon: { - primaryContentCategory.selectedImage - } - } else { - primaryContentCategory.listLabel - } - } -} diff --git a/apple/OmnivoreKit/Sources/Views/PrimaryContainerViews/PrimaryContentView.swift b/apple/OmnivoreKit/Sources/Views/PrimaryContainerViews/PrimaryContentView.swift index 2298b168c..5be1f3e29 100644 --- a/apple/OmnivoreKit/Sources/Views/PrimaryContainerViews/PrimaryContentView.swift +++ b/apple/OmnivoreKit/Sources/Views/PrimaryContainerViews/PrimaryContentView.swift @@ -3,29 +3,20 @@ import Models import SwiftUI public final class PrimaryContentViewModel: ObservableObject { - let categories: [PrimaryContentCategory] - - public enum Action { - case nothing - } - - public var subscriptions = Set() - public let performActionSubject = PassthroughSubject() + let homeFeedViewModel: HomeFeedViewModel + let profileContainerViewModel: ProfileContainerViewModel public init( homeFeedViewModel: HomeFeedViewModel, profileContainerViewModel: ProfileContainerViewModel ) { - self.categories = [ - .feed(viewModel: homeFeedViewModel), - .profile(viewModel: profileContainerViewModel) - ] + self.homeFeedViewModel = homeFeedViewModel + self.profileContainerViewModel = profileContainerViewModel } } public struct PrimaryContentView: View { @ObservedObject private var viewModel: PrimaryContentViewModel - @State private var currentTab = 0 public init(viewModel: PrimaryContentViewModel) { self.viewModel = viewModel @@ -45,27 +36,23 @@ public struct PrimaryContentView: View { // iphone view container private var compactView: some View { - TabView(selection: $currentTab) { - ForEach(viewModel.categories.indices, id: \.self) { index in - viewModel.categories[index].destinationView - .tabItem { - TabIcon(isSelected: currentTab == index, primaryContentCategory: viewModel.categories[index]) - } - .tag(index) - } - } - .accentColor(.appGrayTextContrast) + HomeFeedView(viewModel: viewModel.homeFeedViewModel) } // ipad and mac view container private var regularView: some View { - NavigationView { + let categories = [ + PrimaryContentCategory.feed(viewModel: viewModel.homeFeedViewModel), + PrimaryContentCategory.profile(viewModel: viewModel.profileContainerViewModel) + ] + + return NavigationView { // The first column is the sidebar. - PrimaryContentSidebar(categories: viewModel.categories) + PrimaryContentSidebar(categories: categories) .navigationTitle("Categories") // Initial Content of second column - if let destinationView = viewModel.categories.first?.destinationView { + if let destinationView = categories.first?.destinationView { destinationView } else { Text("Select a Category")