Skip to content

Commit fcb2953

Browse files
authored
Merge pull request #52 from ra1028/v1.0.0
v1.0.0
2 parents f38f581 + c7ee6fd commit fcb2953

22 files changed

Lines changed: 57 additions & 40 deletions

.jazzy.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ skip_undocumented: true
1111
xcodebuild_arguments:
1212
- -sdk
1313
- iphonesimulator
14+
- -scheme
15+
- DifferenceKit

DifferenceKit.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'DifferenceKit'
3-
spec.version = '0.8.0'
3+
spec.version = '1.0.0'
44
spec.author = { 'ra1028' => 'r.fe51028.r@gmail.com' }
55
spec.homepage = 'https://github.com/ra1028/DifferenceKit'
66
spec.documentation_url = 'https://ra1028.github.io/DifferenceKit'

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
source "https://rubygems.org"
22

3-
gem 'cocoapods', '1.6.0.beta.1'
3+
gem 'cocoapods', '1.6.0'
44
gem 'jazzy', '0.9.3'

Gemfile.lock

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,51 @@ GEM
22
remote: https://rubygems.org/
33
specs:
44
CFPropertyList (3.0.0)
5-
activesupport (4.2.10)
5+
activesupport (4.2.11)
66
i18n (~> 0.7)
77
minitest (~> 5.1)
88
thread_safe (~> 0.3, >= 0.3.4)
99
tzinfo (~> 1.1)
1010
atomos (0.1.3)
1111
claide (1.0.2)
12-
cocoapods (1.6.0.beta.1)
12+
cocoapods (1.6.0)
1313
activesupport (>= 4.0.2, < 5)
1414
claide (>= 1.0.2, < 2.0)
15-
cocoapods-core (= 1.6.0.beta.1)
15+
cocoapods-core (= 1.6.0)
1616
cocoapods-deintegrate (>= 1.0.2, < 2.0)
17-
cocoapods-downloader (>= 1.2.1, < 2.0)
17+
cocoapods-downloader (>= 1.2.2, < 2.0)
1818
cocoapods-plugins (>= 1.0.0, < 2.0)
1919
cocoapods-search (>= 1.0.0, < 2.0)
2020
cocoapods-stats (>= 1.0.0, < 2.0)
2121
cocoapods-trunk (>= 1.3.1, < 2.0)
2222
cocoapods-try (>= 1.1.0, < 2.0)
2323
colored2 (~> 3.1)
2424
escape (~> 0.0.4)
25-
fourflusher (~> 2.0.1)
25+
fourflusher (>= 2.2.0, < 3.0)
2626
gh_inspector (~> 1.0)
2727
molinillo (~> 0.6.6)
2828
nap (~> 1.0)
29-
ruby-macho (~> 1.2)
30-
xcodeproj (>= 1.6.0, < 2.0)
31-
cocoapods-core (1.6.0.beta.1)
29+
ruby-macho (~> 1.3, >= 1.3.1)
30+
xcodeproj (>= 1.8.0, < 2.0)
31+
cocoapods-core (1.6.0)
3232
activesupport (>= 4.0.2, < 6)
3333
fuzzy_match (~> 2.0.4)
3434
nap (~> 1.0)
3535
cocoapods-deintegrate (1.0.2)
36-
cocoapods-downloader (1.2.1)
36+
cocoapods-downloader (1.2.2)
3737
cocoapods-plugins (1.0.0)
3838
nap
3939
cocoapods-search (1.0.0)
40-
cocoapods-stats (1.0.0)
40+
cocoapods-stats (1.1.0)
4141
cocoapods-trunk (1.3.1)
4242
nap (>= 0.8, < 2.0)
4343
netrc (~> 0.11)
4444
cocoapods-try (1.1.0)
4545
colored2 (3.1.2)
46-
concurrent-ruby (1.0.5)
46+
concurrent-ruby (1.1.4)
4747
escape (0.0.4)
4848
ffi (1.9.25)
49-
fourflusher (2.0.1)
49+
fourflusher (2.2.0)
5050
fuzzy_match (2.0.4)
5151
gh_inspector (1.1.3)
5252
i18n (0.9.5)
@@ -73,7 +73,7 @@ GEM
7373
ffi (>= 0.5.0, < 2)
7474
redcarpet (3.4.0)
7575
rouge (3.2.1)
76-
ruby-macho (1.2.0)
76+
ruby-macho (1.3.1)
7777
sass (3.5.7)
7878
sass-listen (~> 4.0.0)
7979
sass-listen (4.0.0)
@@ -85,7 +85,7 @@ GEM
8585
thread_safe (~> 0.1)
8686
xcinvoke (0.3.0)
8787
liferaft (~> 0.0.6)
88-
xcodeproj (1.6.0)
88+
xcodeproj (1.8.0)
8989
CFPropertyList (>= 2.3.3, < 4.0)
9090
atomos (~> 0.1.3)
9191
claide (>= 1.0.2, < 2.0)
@@ -96,8 +96,8 @@ PLATFORMS
9696
ruby
9797

9898
DEPENDENCIES
99-
cocoapods (= 1.6.0.beta.1)
99+
cocoapods (= 1.6.0)
100100
jazzy (= 0.9.3)
101101

102102
BUNDLED WITH
103-
1.16.5
103+
1.17.1

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The algorithm is optimized based on the Paul Heckel's algorithm.
1111
<a href="https://github.com/ra1028/DifferenceKit/releases/latest"><img alt="Release" src="https://img.shields.io/github/release/ra1028/DifferenceKit.svg"/></a>
1212
<a href="https://cocoapods.org/pods/DifferenceKit"><img alt="CocoaPods" src="https://img.shields.io/cocoapods/v/DifferenceKit.svg"/></a>
1313
<a href="https://github.com/Carthage/Carthage"><img alt="Carthage" src="https://img.shields.io/badge/Carthage-compatible-yellow.svg"/></a>
14+
<a href="https://swift.org/package-manager"><img alt="Swift Package Manager" src="https://img.shields.io/badge/SwiftPM-compatible-yellowgreen.svg"/></a>
1415
</br>
1516
<a href="https://travis-ci.org/ra1028/DifferenceKit"><img alt="Build Status" src="https://travis-ci.org/ra1028/DifferenceKit.svg?branch=master"/></a>
1617
<a href="https://developer.apple.com/"><img alt="Platform" src="https://img.shields.io/badge/platform-iOS%20%7C%20OSX%20%7C%20tvOS%20%7C%20watchOS-green.svg"/></a>
@@ -55,7 +56,6 @@ Implementation is [here](https://github.com/ra1028/DifferenceKit/blob/master/Sou
5556
---
5657

5758
## Documentation
58-
⚠️ Since DifferenceKit is currently released in alpha version, updates may contain breaking changes.
5959
See docs in [GitHub Pages](https://ra1028.github.io/DifferenceKit/).
6060
Documentation is generated by [jazzy](https://github.com/realm/jazzy).
6161

@@ -333,7 +333,7 @@ let package = Package(
333333
.executable(name: "yourexecutable", targets: ["yourexecutable"]),
334334
],
335335
dependencies: [
336-
.package(url: "https://github.com/ra1028/DifferenceKit.git", from: "any version")
336+
.package(url: "https://github.com/ra1028/DifferenceKit.git", from: "version")
337337
],
338338
targets: [
339339
.target(name: "yourexecutable", dependencies: ["DifferenceKit"])

Sources/AnyDifferentiable.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ public struct AnyDifferentiable: Differentiable {
4444
/// - base: A differentiable value to wrap.
4545
@inlinable
4646
public init<D: Differentiable>(_ base: D) {
47-
box = DifferentiableBox(base)
47+
if let anyDifferentiable = base as? AnyDifferentiable {
48+
self = anyDifferentiable
49+
}
50+
else {
51+
box = DifferentiableBox(base)
52+
}
4853
}
4954

5055
/// Indicate whether the content of `base` is equals to the content of the given source value.
@@ -86,7 +91,7 @@ internal struct DifferentiableBox<Base: Differentiable>: AnyDifferentiableBox {
8691

8792
@inlinable
8893
internal var differenceIdentifier: AnyHashable {
89-
return AnyHashable(baseComponent.differenceIdentifier)
94+
return baseComponent.differenceIdentifier
9095
}
9196

9297
@inlinable

Tests/AnyDifferentiableTest.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,14 @@ final class AnyDifferentiableTestCase: XCTestCase {
3030
XCTAssertEqual(d5.differenceIdentifier, d6.differenceIdentifier)
3131
XCTAssertFalse(d5.isContentEqual(to: d6))
3232
}
33+
34+
func testRedundantWrapping() {
35+
let differentiable = 0
36+
let anyDifferentiable1 = AnyDifferentiable(differentiable)
37+
let anyDifferentiable2 = AnyDifferentiable(anyDifferentiable1)
38+
39+
XCTAssertEqual(anyDifferentiable1.base as? Int, differentiable)
40+
XCTAssertEqual(anyDifferentiable2.base as? Int, differentiable)
41+
XCTAssertEqual(anyDifferentiable1.base as? Int, anyDifferentiable2.base as? Int)
42+
}
3343
}

docs/Extensions.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ <h4>Declaration</h4>
179179
</section>
180180
</section>
181181
<section id="footer">
182-
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-01-21)</p>
182+
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-02-08)</p>
183183
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
184184
</section>
185185
</article>

docs/Extensions/Optional.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ <h4>Return Value</h4>
153153
</section>
154154
</section>
155155
<section id="footer">
156-
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-01-21)</p>
156+
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-02-08)</p>
157157
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
158158
</section>
159159
</article>

docs/Extensions/UICollectionView.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ <h4>Parameters</h4>
181181
</section>
182182
</section>
183183
<section id="footer">
184-
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-01-21)</p>
184+
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-02-08)</p>
185185
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
186186
</section>
187187
</article>

0 commit comments

Comments
 (0)