From 65b463f99304af2287c26d6d01e339b76fbc105e Mon Sep 17 00:00:00 2001 From: Dave Gallagher Date: Thu, 14 Jun 2018 10:27:36 -0700 Subject: [PATCH] Implemented private(set) on properties which need private setters. --- .../Operations/GetConfigurationGroupsOperation.swift | 10 ++++------ QuizTrain/Network/Operations/GetProjectOperation.swift | 10 ++++------ .../Network/Operations/GetTemplatesOperation.swift | 10 ++++------ 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/QuizTrain/Network/Operations/GetConfigurationGroupsOperation.swift b/QuizTrain/Network/Operations/GetConfigurationGroupsOperation.swift index 318d186..c00d537 100644 --- a/QuizTrain/Network/Operations/GetConfigurationGroupsOperation.swift +++ b/QuizTrain/Network/Operations/GetConfigurationGroupsOperation.swift @@ -4,14 +4,13 @@ class GetConfigurationGroupsOperation: AsyncOperation { // MARK: Properties - private weak var _api: ObjectAPI? - var api: ObjectAPI? { return _api } + private(set) weak var api: ObjectAPI? let projectId: Project.Id // MARK: Init init(api: ObjectAPI, projectId: Project.Id) { - self._api = api + self.api = api self.projectId = projectId } @@ -33,14 +32,13 @@ class GetConfigurationGroupsOperation: AsyncOperation { state = .executing api.getConfigurationGroups(inProjectWithId: projectId) { [weak self] (outcome) in - self?._outcome = outcome + self?.outcome = outcome self?.state = .finished } } // MARK: Completion - private var _outcome: Outcome<[ConfigurationGroup], ObjectAPI.GetError>? - var outcome: Outcome<[ConfigurationGroup], ObjectAPI.GetError>? { return _outcome } + private(set) var outcome: Outcome<[ConfigurationGroup], ObjectAPI.GetError>? } diff --git a/QuizTrain/Network/Operations/GetProjectOperation.swift b/QuizTrain/Network/Operations/GetProjectOperation.swift index 9efa811..4be388f 100644 --- a/QuizTrain/Network/Operations/GetProjectOperation.swift +++ b/QuizTrain/Network/Operations/GetProjectOperation.swift @@ -4,14 +4,13 @@ class GetProjectOperation: AsyncOperation { // MARK: Properties - private weak var _api: ObjectAPI? - var api: ObjectAPI? { return _api } + private(set) weak var api: ObjectAPI? let projectId: Project.Id // MARK: Init init(api: ObjectAPI, projectId: Project.Id) { - self._api = api + self.api = api self.projectId = projectId } @@ -33,14 +32,13 @@ class GetProjectOperation: AsyncOperation { state = .executing api.getProject(projectId) { [weak self] (outcome) in - self?._outcome = outcome + self?.outcome = outcome self?.state = .finished } } // MARK: Completion - private var _outcome: Outcome? - var outcome: Outcome? { return _outcome } + private(set) var outcome: Outcome? } diff --git a/QuizTrain/Network/Operations/GetTemplatesOperation.swift b/QuizTrain/Network/Operations/GetTemplatesOperation.swift index 41ae3f2..fb72378 100644 --- a/QuizTrain/Network/Operations/GetTemplatesOperation.swift +++ b/QuizTrain/Network/Operations/GetTemplatesOperation.swift @@ -4,14 +4,13 @@ class GetTemplatesOperation: AsyncOperation { // MARK: Properties - private weak var _api: ObjectAPI? - var api: ObjectAPI? { return _api } + private(set) weak var api: ObjectAPI? let projectId: Project.Id // MARK: Init init(api: ObjectAPI, projectId: Project.Id) { - self._api = api + self.api = api self.projectId = projectId } @@ -33,14 +32,13 @@ class GetTemplatesOperation: AsyncOperation { state = .executing api.getTemplates(inProjectWithId: projectId) { [weak self] (outcome) in - self?._outcome = outcome + self?.outcome = outcome self?.state = .finished } } // MARK: Completion - private var _outcome: Outcome<[Template], ObjectAPI.GetError>? - var outcome: Outcome<[Template], ObjectAPI.GetError>? { return _outcome } + private(set) var outcome: Outcome<[Template], ObjectAPI.GetError>? }