Skip to content

Commit

Permalink
v2.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewBarba committed Mar 16, 2018
1 parent cfc8ff6 commit 9ae7728
Show file tree
Hide file tree
Showing 23 changed files with 36 additions and 150 deletions.
2 changes: 1 addition & 1 deletion Bluebird.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Bluebird'
s.version = '2.3.0'
s.version = '2.4.0'
s.summary = 'Promise/A+, Bluebird inspired, implementation in Swift 4'
s.homepage = 'https://github.com/AndrewBarba/Bluebird.swift'
s.documentation_url = 'https://andrewbarba.github.io/Bluebird.swift/'
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ Change Log

---

## [2.3.0](https://github.com/AndrewBarba/Bluebird.swift/releases/tag/2.3.0)
## [2.4.0](https://github.com/AndrewBarba/Bluebird.swift/releases/tag/2.4.0)

1. Add `Promise.cancel`
2. Add `Promise { resolve, reject, onCancel in }`

## [2.3.0](https://github.com/AndrewBarba/Bluebird.swift/releases/tag/2.3.0)

1. Bad release - see [v2.4.0](https://github.com/AndrewBarba/Bluebird.swift/releases/tag/2.4.0)

## [2.2.0](https://github.com/AndrewBarba/Bluebird.swift/releases/tag/2.2.0)

1. Add `Promise.tapCatch`
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import PackageDescription
let package = Package(
name: "My Lisk App",
dependencies: [
.package(url: "https://github.com/AndrewBarba/Bluebird.swift.git", from: "2.3.0")
.package(url: "https://github.com/AndrewBarba/Bluebird.swift.git", from: "2.4.0")
]
)
```
Expand All @@ -50,13 +50,13 @@ let package = Package(
> CocoaPods 1.1.0+ is required to build Bluebird
```ruby
pod 'Bluebird', '~> 2.3'
pod 'Bluebird', '~> 2.4'
```

### Carthage

```ogdl
github "AndrewBarba/Bluebird.swift" ~> 2.3
github "AndrewBarba/Bluebird.swift" ~> 2.4
```

## Who's Using Bluebird
Expand Down
20 changes: 1 addition & 19 deletions Sources/Promise.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public final class Promise<Result> {

/// Initialize using a resolver function and onCancel block
///
/// - parameter resolver: takes in three blocks, one to resolve, one to reject the promise, and one to run when canceled. onCancel must be called synchronously
/// - parameter resolver: takes in three blocks: one to resolve, one to reject, and one to run when cancelled. onCancel block must be called synchronously, and you pass in a DispatchQueue to run the block on as the first argument
///
/// - returns: Promise
public init(_ resolver: (@escaping (Result) -> Void, @escaping (Error) -> Void, (DispatchQueue, @escaping () -> Void) -> Void) throws -> Void) {
Expand All @@ -151,24 +151,6 @@ public final class Promise<Result> {
set(state: .rejected(error))
}
}

/// Initialize using a resolver function and onCancel block
///
/// - parameter resolver: takes in three blocks, one to resolve, one to reject the promise, and one to run when canceled. onCancel must be called synchronously
///
/// - returns: Promise
public init(_ resolver: (@escaping (Result) -> Void, @escaping (Error) -> Void, (@escaping () -> Void) -> Void) throws -> Void) {
self.state = .pending([])
do {
try resolver(
{ self.set(state: .resolved($0)) },
{ self.set(state: .rejected($0)) },
{ addHandlers([.cancel(.main, $0)]) }
)
} catch {
set(state: .rejected(error))
}
}

/// Convenience initializer to resolve this Promise when a returned Promise is resolved
///
Expand Down
2 changes: 1 addition & 1 deletion docs/Classes.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<a title="Classes Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">Bluebird Docs</a> (72% documented)</p>
<p><a href="index.html">Bluebird Docs</a> (71% documented)</p>
<p class="header-right"><a href="https://github.com/AndrewBarba/Bluebird.swift"><img src="img/gh.png"/>View on GitHub</a></p>
</div>
</header>
Expand Down
54 changes: 2 additions & 52 deletions docs/Classes/Promise.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<a title="Promise Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Bluebird Docs</a> (72% documented)</p>
<p><a href="../index.html">Bluebird Docs</a> (71% documented)</p>
<p class="header-right"><a href="https://github.com/AndrewBarba/Bluebird.swift"><img src="../img/gh.png"/>View on GitHub</a></p>
</div>
</header>
Expand Down Expand Up @@ -388,57 +388,7 @@ <h4>Parameters</h4>
</td>
<td>
<div>
<p>takes in three blocks, one to resolve, one to reject the promise, and one to run when canceled. onCancel must be called synchronously</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>Promise</p>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:8Bluebird7PromiseCACyxGyyxc_ys5Error_pcyyycctKccfc"></a>
<a name="//apple_ref/swift/Method/init(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:8Bluebird7PromiseCACyxGyyxc_ys5Error_pcyyycctKccfc">init(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Initialize using a resolver function and onCancel block</p>

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">_</span> <span class="nv">resolver</span><span class="p">:</span> <span class="p">(</span><span class="kd">@escaping</span> <span class="p">(</span><span class="kt">Result</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">,</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="kt">Error</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">,</span> <span class="p">(</span><span class="kd">@escaping</span> <span class="p">()</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span> <span class="k">throws</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span></code></pre>

</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>resolver</em>
</code>
</td>
<td>
<div>
<p>takes in three blocks, one to resolve, one to reject the promise, and one to run when canceled. onCancel must be called synchronously</p>
<p>takes in three blocks: one to resolve, one to reject, and one to run when cancelled. onCancel block must be called synchronously, and you pass in a DispatchQueue to run the block on as the first argument</p>
</div>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion docs/Enums.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<a title="Enumerations Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">Bluebird Docs</a> (72% documented)</p>
<p><a href="index.html">Bluebird Docs</a> (71% documented)</p>
<p class="header-right"><a href="https://github.com/AndrewBarba/Bluebird.swift"><img src="img/gh.png"/>View on GitHub</a></p>
</div>
</header>
Expand Down
2 changes: 1 addition & 1 deletion docs/Enums/BluebirdError.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<a title="BluebirdError Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Bluebird Docs</a> (72% documented)</p>
<p><a href="../index.html">Bluebird Docs</a> (71% documented)</p>
<p class="header-right"><a href="https://github.com/AndrewBarba/Bluebird.swift"><img src="../img/gh.png"/>View on GitHub</a></p>
</div>
</header>
Expand Down
2 changes: 1 addition & 1 deletion docs/Enums/ReflectionState.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<a title="ReflectionState Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Bluebird Docs</a> (72% documented)</p>
<p><a href="../index.html">Bluebird Docs</a> (71% documented)</p>
<p class="header-right"><a href="https://github.com/AndrewBarba/Bluebird.swift"><img src="../img/gh.png"/>View on GitHub</a></p>
</div>
</header>
Expand Down
2 changes: 1 addition & 1 deletion docs/Functions.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<a title="Functions Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">Bluebird Docs</a> (72% documented)</p>
<p><a href="index.html">Bluebird Docs</a> (71% documented)</p>
<p class="header-right"><a href="https://github.com/AndrewBarba/Bluebird.swift"><img src="img/gh.png"/>View on GitHub</a></p>
</div>
</header>
Expand Down
4 changes: 2 additions & 2 deletions docs/badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<a title="Classes Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">Bluebird Docs</a> (72% documented)</p>
<p><a href="index.html">Bluebird Docs</a> (71% documented)</p>
<p class="header-right"><a href="https://github.com/AndrewBarba/Bluebird.swift"><img src="img/gh.png"/>View on GitHub</a></p>
</div>
</header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<a title="Promise Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Bluebird Docs</a> (72% documented)</p>
<p><a href="../index.html">Bluebird Docs</a> (71% documented)</p>
<p class="header-right"><a href="https://github.com/AndrewBarba/Bluebird.swift"><img src="../img/gh.png"/>View on GitHub</a></p>
</div>
</header>
Expand Down Expand Up @@ -388,57 +388,7 @@ <h4>Parameters</h4>
</td>
<td>
<div>
<p>takes in three blocks, one to resolve, one to reject the promise, and one to run when canceled. onCancel must be called synchronously</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>Promise</p>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:8Bluebird7PromiseCACyxGyyxc_ys5Error_pcyyycctKccfc"></a>
<a name="//apple_ref/swift/Method/init(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:8Bluebird7PromiseCACyxGyyxc_ys5Error_pcyyycctKccfc">init(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Initialize using a resolver function and onCancel block</p>

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">_</span> <span class="nv">resolver</span><span class="p">:</span> <span class="p">(</span><span class="kd">@escaping</span> <span class="p">(</span><span class="kt">Result</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">,</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="kt">Error</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">,</span> <span class="p">(</span><span class="kd">@escaping</span> <span class="p">()</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span> <span class="k">throws</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span></code></pre>

</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>resolver</em>
</code>
</td>
<td>
<div>
<p>takes in three blocks, one to resolve, one to reject the promise, and one to run when canceled. onCancel must be called synchronously</p>
<p>takes in three blocks: one to resolve, one to reject, and one to run when cancelled. onCancel block must be called synchronously, and you pass in a DispatchQueue to run the block on as the first argument</p>
</div>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<a title="Enumerations Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">Bluebird Docs</a> (72% documented)</p>
<p><a href="index.html">Bluebird Docs</a> (71% documented)</p>
<p class="header-right"><a href="https://github.com/AndrewBarba/Bluebird.swift"><img src="img/gh.png"/>View on GitHub</a></p>
</div>
</header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<a title="BluebirdError Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Bluebird Docs</a> (72% documented)</p>
<p><a href="../index.html">Bluebird Docs</a> (71% documented)</p>
<p class="header-right"><a href="https://github.com/AndrewBarba/Bluebird.swift"><img src="../img/gh.png"/>View on GitHub</a></p>
</div>
</header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<a title="ReflectionState Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">Bluebird Docs</a> (72% documented)</p>
<p><a href="../index.html">Bluebird Docs</a> (71% documented)</p>
<p class="header-right"><a href="https://github.com/AndrewBarba/Bluebird.swift"><img src="../img/gh.png"/>View on GitHub</a></p>
</div>
</header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<a title="Functions Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">Bluebird Docs</a> (72% documented)</p>
<p><a href="index.html">Bluebird Docs</a> (71% documented)</p>
<p class="header-right"><a href="https://github.com/AndrewBarba/Bluebird.swift"><img src="img/gh.png"/>View on GitHub</a></p>
</div>
</header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<a title="Bluebird Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">Bluebird Docs</a> (72% documented)</p>
<p><a href="index.html">Bluebird Docs</a> (71% documented)</p>
<p class="header-right"><a href="https://github.com/AndrewBarba/Bluebird.swift"><img src="img/gh.png"/>View on GitHub</a></p>
</div>
</header>
Expand Down Expand Up @@ -146,7 +146,7 @@ <h3 id='swift-package-manager' class='heading'>Swift Package Manager</h3>
<span class="k">let</span> <span class="nv">package</span> <span class="o">=</span> <span class="kt">Package</span><span class="p">(</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"My Lisk App"</span><span class="p">,</span>
<span class="nv">dependencies</span><span class="p">:</span> <span class="p">[</span>
<span class="o">.</span><span class="nf">package</span><span class="p">(</span><span class="nv">url</span><span class="p">:</span> <span class="s">"https://github.com/AndrewBarba/Bluebird.swift.git"</span><span class="p">,</span> <span class="nv">from</span><span class="p">:</span> <span class="s">"2.3.0"</span><span class="p">)</span>
<span class="o">.</span><span class="nf">package</span><span class="p">(</span><span class="nv">url</span><span class="p">:</span> <span class="s">"https://github.com/AndrewBarba/Bluebird.swift.git"</span><span class="p">,</span> <span class="nv">from</span><span class="p">:</span> <span class="s">"2.4.0"</span><span class="p">)</span>
<span class="p">]</span>
<span class="p">)</span>
</code></pre>
Expand All @@ -155,10 +155,10 @@ <h3 id='cocoapods' class='heading'>CocoaPods</h3>
<blockquote>
<p>CocoaPods 1.1.0+ is required to build Bluebird</p>
</blockquote>
<pre class="highlight ruby"><code><span class="n">pod</span> <span class="s1">'Bluebird'</span><span class="p">,</span> <span class="s1">'~&gt; 2.3'</span>
<pre class="highlight ruby"><code><span class="n">pod</span> <span class="s1">'Bluebird'</span><span class="p">,</span> <span class="s1">'~&gt; 2.4'</span>
</code></pre>
<h3 id='carthage' class='heading'>Carthage</h3>
<pre class="highlight plaintext"><code>github "AndrewBarba/Bluebird.swift" ~&gt; 2.3
<pre class="highlight plaintext"><code>github "AndrewBarba/Bluebird.swift" ~&gt; 2.4
</code></pre>
<h2 id='who-39-s-using-bluebird' class='heading'>Who&rsquo;s Using Bluebird</h2>

Expand Down
Loading

0 comments on commit 9ae7728

Please sign in to comment.