From a729058addf617de7cc231b9da09c3d36da1b2d9 Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Wed, 9 Sep 2020 16:00:10 -0700 Subject: [PATCH] Renaming --- ...avigationViewModel.swift => NavigationViewModel.swift} | 8 ++++---- ViewModels/Sources/ViewModels/RootViewModel.swift | 4 ++-- Views/ListsView.swift | 2 +- Views/SecondaryNavigationView.swift | 4 ++-- Views/StatusListView.swift | 2 +- Views/TabNavigationView.swift | 8 ++++---- 6 files changed, 14 insertions(+), 14 deletions(-) rename ViewModels/Sources/ViewModels/{TabNavigationViewModel.swift => NavigationViewModel.swift} (94%) diff --git a/ViewModels/Sources/ViewModels/TabNavigationViewModel.swift b/ViewModels/Sources/ViewModels/NavigationViewModel.swift similarity index 94% rename from ViewModels/Sources/ViewModels/TabNavigationViewModel.swift rename to ViewModels/Sources/ViewModels/NavigationViewModel.swift index 0e33815..b06c583 100644 --- a/ViewModels/Sources/ViewModels/TabNavigationViewModel.swift +++ b/ViewModels/Sources/ViewModels/NavigationViewModel.swift @@ -5,7 +5,7 @@ import Foundation import Mastodon import ServiceLayer -public final class TabNavigationViewModel: ObservableObject { +public final class NavigationViewModel: ObservableObject { public let identification: Identification @Published public private(set) var recentIdentities = [Identity]() @Published public var timeline: Timeline @@ -40,7 +40,7 @@ public final class TabNavigationViewModel: ObservableObject { } } -public extension TabNavigationViewModel { +public extension NavigationViewModel { var tabs: [Tab] { if identification.service.isAuthorized { return Tab.allCases @@ -92,7 +92,7 @@ public extension TabNavigationViewModel { } } -public extension TabNavigationViewModel { +public extension NavigationViewModel { enum Tab: CaseIterable { case timelines case explore @@ -101,6 +101,6 @@ public extension TabNavigationViewModel { } } -extension TabNavigationViewModel.Tab: Identifiable { +extension NavigationViewModel.Tab: Identifiable { public var id: Self { self } } diff --git a/ViewModels/Sources/ViewModels/RootViewModel.swift b/ViewModels/Sources/ViewModels/RootViewModel.swift index b126bbd..784b4bb 100644 --- a/ViewModels/Sources/ViewModels/RootViewModel.swift +++ b/ViewModels/Sources/ViewModels/RootViewModel.swift @@ -5,7 +5,7 @@ import Foundation import ServiceLayer public final class RootViewModel: ObservableObject { - @Published public private(set) var navigationViewModel: TabNavigationViewModel? + @Published public private(set) var navigationViewModel: NavigationViewModel? @Published private var mostRecentlyUsedIdentityID: UUID? private let environment: AppEnvironment @@ -100,7 +100,7 @@ private extension RootViewModel { .store(in: &self.cancellables) } - return TabNavigationViewModel(identification: identification) + return NavigationViewModel(identification: identification) } .assign(to: &$navigationViewModel) } diff --git a/Views/ListsView.swift b/Views/ListsView.swift index ada2cdd..36bb31c 100644 --- a/Views/ListsView.swift +++ b/Views/ListsView.swift @@ -61,7 +61,7 @@ import PreviewViewModels struct ListsView_Previews: PreviewProvider { static var previews: some View { ListsView(viewModel: .init(identification: .preview)) - .environmentObject(TabNavigationViewModel(identification: .preview)) + .environmentObject(NavigationViewModel(identification: .preview)) } } #endif diff --git a/Views/SecondaryNavigationView.swift b/Views/SecondaryNavigationView.swift index 558ccbf..a4a0dc9 100644 --- a/Views/SecondaryNavigationView.swift +++ b/Views/SecondaryNavigationView.swift @@ -5,7 +5,7 @@ import SwiftUI import ViewModels struct SecondaryNavigationView: View { - @ObservedObject var viewModel: TabNavigationViewModel + @ObservedObject var viewModel: NavigationViewModel @EnvironmentObject var identification: Identification @EnvironmentObject var rootViewModel: RootViewModel @Environment(\.displayScale) var displayScale: CGFloat @@ -85,7 +85,7 @@ import PreviewViewModels struct SecondaryNavigationView_Previews: PreviewProvider { static var previews: some View { - SecondaryNavigationView(viewModel: TabNavigationViewModel(identification: .preview)) + SecondaryNavigationView(viewModel: NavigationViewModel(identification: .preview)) .environmentObject(Identification.preview) .environmentObject(RootViewModel.preview) } diff --git a/Views/StatusListView.swift b/Views/StatusListView.swift index c63583e..cc49972 100644 --- a/Views/StatusListView.swift +++ b/Views/StatusListView.swift @@ -20,7 +20,7 @@ import PreviewViewModels struct StatusListView_Previews: PreviewProvider { static var previews: some View { - StatusListView(viewModel: TabNavigationViewModel(identification: .preview).viewModel(timeline: .home)) + StatusListView(viewModel: NavigationViewModel(identification: .preview).viewModel(timeline: .home)) } } #endif diff --git a/Views/TabNavigationView.swift b/Views/TabNavigationView.swift index 21e3edb..419e6b4 100644 --- a/Views/TabNavigationView.swift +++ b/Views/TabNavigationView.swift @@ -6,7 +6,7 @@ import SwiftUI import ViewModels struct TabNavigationView: View { - @ObservedObject var viewModel: TabNavigationViewModel + @ObservedObject var viewModel: NavigationViewModel @EnvironmentObject var rootViewModel: RootViewModel @Environment(\.displayScale) var displayScale: CGFloat @@ -42,7 +42,7 @@ struct TabNavigationView: View { private extension TabNavigationView { @ViewBuilder - func view(tab: TabNavigationViewModel.Tab) -> some View { + func view(tab: NavigationViewModel.Tab) -> some View { switch tab { case .timelines: StatusListView(viewModel: viewModel.viewModel(timeline: viewModel.timeline)) @@ -133,7 +133,7 @@ private extension Timeline { } } -extension TabNavigationViewModel.Tab { +extension NavigationViewModel.Tab { var title: String { switch self { case .timelines: return "Timelines" @@ -158,7 +158,7 @@ import PreviewViewModels struct TabNavigation_Previews: PreviewProvider { static var previews: some View { - TabNavigationView(viewModel: TabNavigationViewModel(identification: .preview)) + TabNavigationView(viewModel: NavigationViewModel(identification: .preview)) .environmentObject(Identification.preview) .environmentObject(RootViewModel.preview) }