Skip to content

Commit

Permalink
Merge pull request #6 from venmo/privateSet
Browse files Browse the repository at this point in the history
Implemented private(set) on properties which need private setters.
  • Loading branch information
dgallagher-venmo authored Jun 14, 2018
2 parents 5a9f5d5 + 65b463f commit e7d1b13
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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>?

}
10 changes: 4 additions & 6 deletions QuizTrain/Network/Operations/GetProjectOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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<Project, ObjectAPI.GetError>?
var outcome: Outcome<Project, ObjectAPI.GetError>? { return _outcome }
private(set) var outcome: Outcome<Project, ObjectAPI.GetError>?

}
10 changes: 4 additions & 6 deletions QuizTrain/Network/Operations/GetTemplatesOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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>?

}

0 comments on commit e7d1b13

Please sign in to comment.