From 677c0e6a1ae7ec7c6a9c7282be2c86f67f793d51 Mon Sep 17 00:00:00 2001 From: Otavio Cordeiro Date: Sat, 2 Jan 2021 22:49:24 +0100 Subject: [PATCH] Mark several properties as private --- Pinboarding/Repository/PinboardRepository.swift | 12 +++++++++--- Pinboarding/Views/Main/MainView.swift | 5 ++--- Pinboarding/Views/Settings/SettingsView.swift | 2 +- Pinboarding/Views/Sidebar/SidebarViewModel.swift | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Pinboarding/Repository/PinboardRepository.swift b/Pinboarding/Repository/PinboardRepository.swift index ad74de4..5556b32 100644 --- a/Pinboarding/Repository/PinboardRepository.swift +++ b/Pinboarding/Repository/PinboardRepository.swift @@ -6,9 +6,8 @@ public class PinboardRepository: ObservableObject { // MARK: - Properties - let persistenceController: PersistenceController - let networkController: NetworkController - + private let persistenceController: PersistenceController + private let networkController: NetworkController private var cancellables = Set() // MARK: - Life cycle @@ -51,4 +50,11 @@ public class PinboardRepository: ObservableObject { .map(persistenceController.appendNewPostPublisher) .eraseToAnyPublisher() } + + /// Publishes the network status to update the UI + /// during update requests. + func networkActivityPublisher( + ) -> AnyPublisher { + networkController.networkActivityPublisher() + } } diff --git a/Pinboarding/Views/Main/MainView.swift b/Pinboarding/Views/Main/MainView.swift index dd89139..39c3350 100644 --- a/Pinboarding/Views/Main/MainView.swift +++ b/Pinboarding/Views/Main/MainView.swift @@ -4,7 +4,7 @@ struct MainView: View { // MARK: - Properties - @EnvironmentObject var repository: PinboardRepository + @EnvironmentObject private var repository: PinboardRepository @State private var showAddBookmark = false // MARK: - Public @@ -13,8 +13,7 @@ struct MainView: View { NavigationView { SidebarView( viewModel: SidebarViewModel( - networkActivityPublisher: repository.networkController - .networkActivityPublisher() + networkActivityPublisher: repository.networkActivityPublisher() ) ) diff --git a/Pinboarding/Views/Settings/SettingsView.swift b/Pinboarding/Views/Settings/SettingsView.swift index ffc7393..d8cdb7b 100644 --- a/Pinboarding/Views/Settings/SettingsView.swift +++ b/Pinboarding/Views/Settings/SettingsView.swift @@ -10,7 +10,7 @@ struct SettingsView: View { // MARK: - Properties - @EnvironmentObject var userDefaultsStore: UserDefaultsStore + @EnvironmentObject private var userDefaultsStore: UserDefaultsStore // MARK: - Public diff --git a/Pinboarding/Views/Sidebar/SidebarViewModel.swift b/Pinboarding/Views/Sidebar/SidebarViewModel.swift index ac14563..3cbbfa7 100644 --- a/Pinboarding/Views/Sidebar/SidebarViewModel.swift +++ b/Pinboarding/Views/Sidebar/SidebarViewModel.swift @@ -5,7 +5,7 @@ final class SidebarViewModel: ObservableObject { // MARK: - Properties - @Published var isLoading = false + @Published private(set) var isLoading = false private var cancellables = Set()