Skip to content

Commit

Permalink
Merge pull request #13 from albertodebortoli/future-public-methods
Browse files Browse the repository at this point in the history
Make Future's setResult, setError and cancel methods public
  • Loading branch information
albertodebortoli committed Jun 30, 2020
2 parents b9021e6 + fe17ff9 commit 3cc8285
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Promis/Classes/Future.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,14 @@ public class Future<ResultType> {
return !timeoutExpired
}

// MARK: State setting (Private)
// MARK: State setting

/**
Resolves the receiver by setting a result.
- parameter result: The result to use for the resolution.
*/
func setResult(_ result: ResultType) {
public func setResult(_ result: ResultType) {
cv.lock()
assert(state == .unresolved, "Cannot set result. Future already resolved")

Expand All @@ -195,7 +195,7 @@ public class Future<ResultType> {
- parameter error: The error to use for the resolution.
*/
func setError(_ error: Error) {
public func setError(_ error: Error) {
cv.lock()
assert(state == .unresolved, "Cannot set error. Future already resolved")

Expand All @@ -214,7 +214,7 @@ public class Future<ResultType> {
/**
Resolves the receiver by cancelling it.
*/
func cancel() {
public func cancel() {
cv.lock()
assert(state == .unresolved, "Cannot cancel. Future already resolved")

Expand Down

0 comments on commit 3cc8285

Please sign in to comment.