This repository has been archived by the owner on Aug 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
Move Task functionality into conditional conformances #253
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zwaldowski
commented
Sep 17, 2018
zwaldowski
commented
Sep 17, 2018
Sources/Task/TaskAsync.swift
Outdated
@@ -6,10 +6,10 @@ | |||
// Copyright © 2015-2018 Big Nerd Ranch. Licensed under MIT. | |||
// | |||
|
|||
import Dispatch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rewrite this out.
zwaldowski
commented
Sep 17, 2018
Sources/Task/TaskProgress.swift
Outdated
@@ -201,13 +201,12 @@ extension Progress { | |||
let progress = Progress(totalUnitCount: 0) | |||
progress.completedUnitCount = 1 | |||
progress.isCancellable = false | |||
progress.isPausable = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this, not related to this PR
zwaldowski
commented
Sep 17, 2018
Sources/Task/TaskProgress.swift
Outdated
return progress | ||
} | ||
|
||
/// A simple indeterminate progress with a cancellation function. | ||
static func wrappingCompletion<OtherFuture: FutureProtocol>(of base: OtherFuture, cancellation: (() -> Void)?) -> Progress { | ||
let totalUnitCount: Int64 = base.wait(until: .now()) != nil ? 0 : -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split this out, not related to this PR
zwaldowski
commented
Sep 17, 2018
zwaldowski
force-pushed
the
zwaldowski/conditional-task
branch
from
September 19, 2018 02:29
3a855e2
to
b8622b3
Compare
zwaldowski
force-pushed
the
zwaldowski/conditional-task
branch
from
September 19, 2018 02:34
b8622b3
to
3b25cb2
Compare
zwaldowski
force-pushed
the
zwaldowski/conditional-task
branch
from
September 19, 2018 02:38
3b25cb2
to
d8beda2
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's in this pull request?
Working towards #224.
Extracts
extension Task
andextension FutureProtocol where BlahBlahBlah
intoextension TaskProtocol
. It resolves the major ergonomic issues withTask
methods, allowing you to call themap
,andThen
, etc. you're expecting to onFuture<TaskResult<T>>
without wrapping it asTask
. Beyond that, the idea is to reduce complexity in the API and to reduce the occurrence of compiler errors from not extending the right thing.Testing
None intended.
API Changes
Many, but they should be source-compatible.