Skip to content

Commit

Permalink
Support macOS, watch OS
Browse files Browse the repository at this point in the history
  • Loading branch information
ra1028 committed Aug 5, 2018
1 parent 1e8c13b commit c55e32a
Show file tree
Hide file tree
Showing 21 changed files with 61 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ output: docs
theme: apple
clean: true
skip_undocumented: true
xcodebuild_arguments: [-workspace, 'DifferenceKit.xcworkspace', -scheme, 'DifferenceKit']
xcodebuild_arguments: [-workspace, 'DifferenceKit.xcworkspace', -scheme, 'DifferenceKit', -sdk, 'iphonesimulator']
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ matrix:
osx_image: xcode9.4
script:
- set -o pipefail
- xcodebuild build-for-testing test-without-building -scheme DifferenceKit -configuration Release ENABLE_TESTABILITY=YES | xcpretty -c
- xcodebuild build-for-testing test-without-building -scheme DifferenceKit -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 8' ENABLE_TESTABILITY=YES | xcpretty - c
- xcodebuild build-for-testing test-without-building -scheme DifferenceKit -configuration Release -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV' ENABLE_TESTABILITY=YES | xcpretty -c

- xcodebuild build -scheme DifferenceKit -configuration Release -sdk watchsimulator -destination 'platform=watchOS Simulator,name=Apple Watch - 38mm' ENABLE_TESTABILITY=YES | xcpretty -c
notifications:
email: false
9 changes: 7 additions & 2 deletions Configurations/DifferenceKit.xcconfig
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
MACOSX_DEPLOYMENT_TARGET = 10.9
IPHONEOS_DEPLOYMENT_TARGET = 9.0
TVOS_DEPLOYMENT_TARGET = 9.0
WATCHOS_DEPLOYMENT_TARGET = 2.0

SDKROOT =
SUPPORTED_PLATFORMS = iphoneos iphonesimulator appletvos appletvsimulator
TARGETED_DEVICE_FAMILY = 1,2,3
SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator
TARGETED_DEVICE_FAMILY = 1,2,3,4
VALID_ARCHS[sdk=macosx*] = i386 x86_64
VALID_ARCHS[sdk=iphoneos*] = arm64 armv7 armv7s
VALID_ARCHS[sdk=iphonesimulator*] = i386 x86_64
VALID_ARCHS[sdk=appletv*] = arm64
VALID_ARCHS[sdk=appletvsimulator*] = x86_64
VALID_ARCHS[sdk=watchos*] = armv7k
VALID_ARCHS[sdk=watchsimulator*] = i386

CODE_SIGN_IDENTITY =
CODE_SIGN_STYLE = Manual
Expand Down
6 changes: 4 additions & 2 deletions DifferenceKit.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'DifferenceKit'
spec.version = '0.1.0'
spec.version = '0.2.0'
spec.author = { 'ra1028' => '[email protected]' }
spec.homepage = 'https://github.com/ra1028/DifferenceKit'
spec.documentation_url = 'https://ra1028.github.io/DifferenceKit'
Expand All @@ -15,7 +15,9 @@ Pod::Spec.new do |spec|
spec.default_subspecs = 'Core', 'UIExtensions'

spec.ios.deployment_target = '9.0'
spec.tvos.deployment_target = "9.0"
spec.tvos.deployment_target = '9.0'
spec.osx.deployment_target = '10.9'
spec.watchos.deployment_target = '2.0'

spec.subspec 'Core' do |subspec|
subspec.source_files = 'Sources/*.swift'
Expand Down
8 changes: 4 additions & 4 deletions DifferenceKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
};
name = Debug;
};
Expand Down Expand Up @@ -473,7 +473,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
};
name = Release;
};
Expand All @@ -495,7 +495,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
};
name = Debug;
};
Expand All @@ -516,7 +516,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.ryo.DifferenceKitTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
};
name = Release;
};
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ The algorithm is optimized based on the Paul Heckel's algorithm.

<p align="center">
<a href="https://developer.apple.com/swift"><img alt="Swift4" src="https://img.shields.io/badge/language-swift4-orange.svg?style=flat"/></a>
<a href="https://developer.apple.com/swift/"><img alt="Platform" src="https://img.shields.io/badge/platform-iOS%20%7C%20tvOS-green.svg"/></a>
<a href="https://github.com/ra1028/DifferenceKit/blob/master/LICENSE"><img alt="Lincense" src="http:https://img.shields.io/badge/license-MIT-000000.svg?style=flat"/></a>
</br>
<a href="https://travis-ci.org/ra1028/DifferenceKit"><img alt="Build Status" src="https://travis-ci.org/ra1028/DifferenceKit.svg?branch=master"/></a>
<a href="https://cocoapods.org/pods/DifferenceKit"><img alt="CocoaPods" src="https://img.shields.io/cocoapods/v/DifferenceKit.svg"/></a>
<a href="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/Carthage/Carthage"><img alt="Carthage" src="https://img.shields.io/badge/Carthage-compatible-yellow.svg?style=flat"/></a>
</br>
<a href="https://travis-ci.org/ra1028/DifferenceKit"><img alt="Build Status" src="https://travis-ci.org/ra1028/DifferenceKit.svg?branch=master"/></a>
<a href="https://developer.apple.com/swift/"><img alt="Platform" src="https://img.shields.io/badge/platform-iOS%20%7C%20OSX%20%7C%20tvOS%20%7C%20watchOS-green.svg"/></a>
<a href="https://github.com/ra1028/DifferenceKit/blob/master/LICENSE"><img alt="Lincense" src="http:https://img.shields.io/badge/license-MIT-000000.svg?style=flat"/></a>
</p>

---
Expand Down Expand Up @@ -147,7 +147,7 @@ collectionView.reload(using: changeset, interrupt: { $0.changeCount > 100 }) { d
Made a fair comparison as much as possible in features and performance with other **popular** and **awesome** frameworks.
The frameworks and its version that compared is below.

- [DifferenceKit](https://github.com/ra1028/DifferenceKit) - 0.1.0
- [DifferenceKit](https://github.com/ra1028/DifferenceKit) - 0.2.0
- [RxDataSources](https://github.com/RxSwiftCommunity/RxDataSources) ([Differentiator](https://github.com/RxSwiftCommunity/RxDataSources/tree/master/Sources/Differentiator)) - 3.0.2
- [IGListKit](https://github.com/Instagram/IGListKit) - 3.4.0
- [ListDiff](https://github.com/lxcid/ListDiff) - 0.1.0
Expand Down Expand Up @@ -237,6 +237,8 @@ Use `Foundation.UUID` as an element.
- Swift4.1+
- iOS 9.0+
- tvOS 9.0+
- OS X 10.9+ (only algorithm)
- watchOS 2.0+ (only algorithm)

---

Expand Down
8 changes: 4 additions & 4 deletions Sources/StagedChangeset.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
/// let source = ["A", "B", "C"]
/// let target = ["B", "C", "D"]
///
/// let changeset1 = StagedChangeset(source: source, target: target)
/// print(changeset1.isEmpty) // prints "false"
/// let changeset = StagedChangeset(source: source, target: target)
/// print(changeset.isEmpty) // prints "false"
///
/// Example for calculating differences between the two sectioned collections.
///
Expand All @@ -27,8 +27,8 @@
/// Section(model: "B", elements: ["馃槳"])
/// ]
///
/// let changeset2 = StagedChangeset(source: sectionedSource, target: sectionedTarget)
/// print(changeset2.isEmpty) // prints "false"
/// let changeset = StagedChangeset(source: sectionedSource, target: sectionedTarget)
/// print(changeset.isEmpty) // prints "false"
public struct StagedChangeset<Collection: Swift.Collection> {
private var changesets: ContiguousArray<Changeset<Collection>>

Expand Down
2 changes: 1 addition & 1 deletion Sources/UIExtensions/UIKitExtension.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if canImport(UIKit)
#if os(iOS) || os(tvOS)
import UIKit

public extension UITableView {
Expand Down
2 changes: 1 addition & 1 deletion docs/Extensions.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-03)</p>
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-06)</p>
<p>Generated by <a class="link" href="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/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>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Extensions/UICollectionView.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ <h4>Parameters</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-03)</p>
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-06)</p>
<p>Generated by <a class="link" href="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/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>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Extensions/UITableView.html
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ <h4>Parameters</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-03)</p>
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-06)</p>
<p>Generated by <a class="link" href="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/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>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Protocols.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-03)</p>
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-06)</p>
<p>Generated by <a class="link" href="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/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>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Protocols/Differentiable.html
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ <h4>Return Value</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-03)</p>
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-06)</p>
<p>Generated by <a class="link" href="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/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>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Protocols/DifferentiableSection.html
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ <h4>Parameters</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-03)</p>
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-06)</p>
<p>Generated by <a class="link" href="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/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>
</section>
</article>
Expand Down
10 changes: 5 additions & 5 deletions docs/Structs.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ <h1>Structures</h1>
<span class="k">let</span> <span class="nv">source</span> <span class="o">=</span> <span class="p">[</span><span class="s">"A"</span><span class="p">,</span> <span class="s">"B"</span><span class="p">,</span> <span class="s">"C"</span><span class="p">]</span>
<span class="k">let</span> <span class="nv">target</span> <span class="o">=</span> <span class="p">[</span><span class="s">"B"</span><span class="p">,</span> <span class="s">"C"</span><span class="p">,</span> <span class="s">"D"</span><span class="p">]</span>

<span class="k">let</span> <span class="nv">changeset1</span> <span class="o">=</span> <span class="nf">StagedChangeset</span><span class="p">(</span><span class="nv">source</span><span class="p">:</span> <span class="n">source</span><span class="p">,</span> <span class="nv">target</span><span class="p">:</span> <span class="n">target</span><span class="p">)</span>
<span class="nf">print</span><span class="p">(</span><span class="n">changeset1</span><span class="o">.</span><span class="n">isEmpty</span><span class="p">)</span> <span class="c1">// prints "false"</span>
<span class="k">let</span> <span class="nv">changeset</span> <span class="o">=</span> <span class="nf">StagedChangeset</span><span class="p">(</span><span class="nv">source</span><span class="p">:</span> <span class="n">source</span><span class="p">,</span> <span class="nv">target</span><span class="p">:</span> <span class="n">target</span><span class="p">)</span>
<span class="nf">print</span><span class="p">(</span><span class="n">changeset</span><span class="o">.</span><span class="n">isEmpty</span><span class="p">)</span> <span class="c1">// prints "false"</span>
</code></pre>

<p>Example for calculating differences between the two sectioned collections.</p>
Expand All @@ -123,8 +123,8 @@ <h1>Structures</h1>
<span class="nf">Section</span><span class="p">(</span><span class="nv">model</span><span class="p">:</span> <span class="s">"B"</span><span class="p">,</span> <span class="nv">elements</span><span class="p">:</span> <span class="p">[</span><span class="s">"馃槳"</span><span class="p">])</span>
<span class="p">]</span>

<span class="k">let</span> <span class="nv">changeset2</span> <span class="o">=</span> <span class="nf">StagedChangeset</span><span class="p">(</span><span class="nv">source</span><span class="p">:</span> <span class="n">sectionedSource</span><span class="p">,</span> <span class="nv">target</span><span class="p">:</span> <span class="n">sectionedTarget</span><span class="p">)</span>
<span class="nf">print</span><span class="p">(</span><span class="n">changeset2</span><span class="o">.</span><span class="n">isEmpty</span><span class="p">)</span> <span class="c1">// prints "false"</span>
<span class="k">let</span> <span class="nv">changeset</span> <span class="o">=</span> <span class="nf">StagedChangeset</span><span class="p">(</span><span class="nv">source</span><span class="p">:</span> <span class="n">sectionedSource</span><span class="p">,</span> <span class="nv">target</span><span class="p">:</span> <span class="n">sectionedTarget</span><span class="p">)</span>
<span class="nf">print</span><span class="p">(</span><span class="n">changeset</span><span class="o">.</span><span class="n">isEmpty</span><span class="p">)</span> <span class="c1">// prints "false"</span>
</code></pre>

<a href="Structs/StagedChangeset.html" class="slightly-smaller">See more</a>
Expand Down Expand Up @@ -309,7 +309,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-03)</p>
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-06)</p>
<p>Generated by <a class="link" href="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/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>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Structs/AnyDifferentiable.html
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-03)</p>
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-06)</p>
<p>Generated by <a class="link" href="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/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>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Structs/Changeset.html
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-03)</p>
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-06)</p>
<p>Generated by <a class="link" href="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/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>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Structs/ElementPath.html
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-03)</p>
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-06)</p>
<p>Generated by <a class="link" href="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/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>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Structs/Section.html
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-03)</p>
<p>&copy; 2018 <a class="link" href="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/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2018-08-06)</p>
<p>Generated by <a class="link" href="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/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>
</section>
</article>
Expand Down
Loading

0 comments on commit c55e32a

Please sign in to comment.