Skip to content

Commit

Permalink
Merge pull request #8 from ra1028/swift5-cmpatibility
Browse files Browse the repository at this point in the history
Swift5 compatibility
  • Loading branch information
ra1028 authored Mar 28, 2019
2 parents 89e48b7 + e958cc6 commit 9acc419
Show file tree
Hide file tree
Showing 59 changed files with 118 additions and 95 deletions.
25 changes: 15 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
env:
global:
- LC_CTYPE=en_US.UTF-8
aliases:
- &testing_xcode
os: osx
language: objective-c
install:
- ./scripts/install_swiftlint.sh
script:
- set -o pipefail
- xcodebuild build-for-testing test-without-building -workspace Carbon.xcworkspace -scheme Carbon -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone X' ENABLE_TESTABILITY=YES | xcpretty - c

matrix:
include:
- os: osx
language: objective-c
- <<: *testing_xcode
osx_image: xcode10.1
install:
- ./scripts/install_swiftlint.sh
script:
- xcodebuild build-for-testing test-without-building -workspace Carbon.xcworkspace -scheme Carbon -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone X' ENABLE_TESTABILITY=YES | xcpretty - c

- <<: *testing_xcode
osx_image: xcode10.2

notifications:
email: false
email: false
14 changes: 7 additions & 7 deletions Carbon.playground/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,20 @@ renderer.render(
id: 1,
header: ViewNode(Label(text: "Header 1")),
cells: [
CellNode(id: 1, component: Label(text: "Cell 1")),
CellNode(id: 2, component: Label(text: "Cell 2")),
CellNode(id: 3, component: Label(text: "Cell 3")),
CellNode(id: 4, component: Label(text: "Cell 4"))
CellNode(id: 1, Label(text: "Cell 1")),
CellNode(id: 2, Label(text: "Cell 2")),
CellNode(id: 3, Label(text: "Cell 3")),
CellNode(id: 4, Label(text: "Cell 4"))
],
footer: ViewNode(Label(text: "Footer 1"))
),
Section(
id: 2,
header: ViewNode(Label(text: "Header 2")),
cells: [
CellNode(id: 5, component: Label(text: "Cell 5")),
CellNode(id: 6, component: Label(text: "Cell 6")),
CellNode(id: 7, component: Label(text: "Cell 7"))
CellNode(id: 5, Label(text: "Cell 5")),
CellNode(id: 6, Label(text: "Cell 6")),
CellNode(id: 7, Label(text: "Cell 7"))
],
footer: ViewNode(Label(text: "Footer 2"))
)
Expand Down
2 changes: 1 addition & 1 deletion Carbon.playground/contents.xcplayground
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios' display-mode='rendered' executeOnSourceChanges='false'>
<playground version='5.0' target-platform='ios' display-mode='rendered'>
<timeline fileName='timeline.xctimeline'/>
</playground>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
4 changes: 2 additions & 2 deletions Carbon.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'Carbon'
spec.version = '0.1.0'
spec.version = '0.2.0'
spec.author = { 'ra1028' => '[email protected]' }
spec.homepage = 'https://github.com/ra1028/Carbon'
spec.documentation_url = 'https://ra1028.github.io/Carbon'
Expand All @@ -11,6 +11,6 @@ Pod::Spec.new do |spec|
spec.requires_arc = true
spec.swift_version = '4.2'
spec.ios.deployment_target = '10.0'
spec.dependency 'DifferenceKit/Core', "~> 1.0.0"
spec.dependency 'DifferenceKit/Core', "~> 1.1"
spec.ios.frameworks = 'UIKit'
end
3 changes: 3 additions & 0 deletions Carbon.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,11 @@
TargetAttributes = {
6B65947921E252E300291AAF = {
CreatedOnToolsVersion = 10.1;
LastSwiftMigration = 1020;
};
6B7ADEAD21F783E3003803BE = {
CreatedOnToolsVersion = 10.1;
LastSwiftMigration = 1020;
};
};
};
Expand All @@ -375,6 +377,7 @@
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 6B65947021E252E300291AAF;
productRefGroup = 6B65947B21E252E300291AAF /* Products */;
Expand Down
2 changes: 1 addition & 1 deletion Carbon.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ra1028/DifferenceKit" ~> 1.0.0
github "ra1028/DifferenceKit" ~> 1.1
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ra1028/DifferenceKit" "1.0.0"
github "ra1028/DifferenceKit" "1.1.0"
1 change: 1 addition & 0 deletions Examples/Example-iOS/Example-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@
TargetAttributes = {
6B6594CB21E2619B00291AAF = {
CreatedOnToolsVersion = 10.1;
LastSwiftMigration = 1020;
};
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"images" : [
{
"idiom" : "universal",
"filename" : "KyotoByōdōIn.jpg"
"filename" : "KyotoByōdōIn.jpg"
}
],
"info" : {
Expand Down
2 changes: 1 addition & 1 deletion Examples/Example-iOS/Sources/Form/FormViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final class FormViewController: UIViewController {
title = "Profile Form"
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = UITableView.automaticDimension
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillChangeFrame), name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillChangeFrame), name: UIResponder.keyboardWillChangeFrameNotification, object: nil)

renderer.updater.deleteRowsAnimation = .middle
renderer.updater.insertRowsAnimation = .middle
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source "https://rubygems.org"

gem 'cocoapods', '1.6.0'
gem 'cocoapods', '1.6.1'
gem 'jazzy', '0.9.4'
22 changes: 11 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.0)
activesupport (4.2.11)
activesupport (4.2.11.1)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
atomos (0.1.3)
claide (1.0.2)
cocoapods (1.6.0)
cocoapods (1.6.1)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.6.0)
cocoapods-core (= 1.6.1)
cocoapods-deintegrate (>= 1.0.2, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
Expand All @@ -26,13 +26,13 @@ GEM
gh_inspector (~> 1.0)
molinillo (~> 0.6.6)
nap (~> 1.0)
ruby-macho (~> 1.3, >= 1.3.1)
xcodeproj (>= 1.8.0, < 2.0)
cocoapods-core (1.6.0)
ruby-macho (~> 1.4)
xcodeproj (>= 1.8.1, < 2.0)
cocoapods-core (1.6.1)
activesupport (>= 4.0.2, < 6)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.2)
cocoapods-deintegrate (1.0.3)
cocoapods-downloader (1.2.2)
cocoapods-plugins (1.0.0)
nap
Expand All @@ -43,7 +43,7 @@ GEM
netrc (~> 0.11)
cocoapods-try (1.1.0)
colored2 (3.1.2)
concurrent-ruby (1.1.4)
concurrent-ruby (1.1.5)
escape (0.0.4)
ffi (1.10.0)
fourflusher (2.2.0)
Expand Down Expand Up @@ -73,7 +73,7 @@ GEM
ffi (~> 1.0)
redcarpet (3.4.0)
rouge (3.3.0)
ruby-macho (1.3.1)
ruby-macho (1.4.0)
sass (3.7.3)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
Expand All @@ -85,7 +85,7 @@ GEM
thread_safe (~> 0.1)
xcinvoke (0.3.0)
liferaft (~> 0.0.6)
xcodeproj (1.8.0)
xcodeproj (1.8.1)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand All @@ -96,7 +96,7 @@ PLATFORMS
ruby

DEPENDENCIES
cocoapods (= 1.6.0)
cocoapods (= 1.6.1)
jazzy (= 0.9.4)

BUNDLED WITH
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ in UITableView and UICollectionView.</br>
</H4>

<p align="center">
<a href="https://developer.apple.com/swift"><img alt="Swift4.2" src="https://img.shields.io/badge/language-Swift4.2-orange.svg"/></a>
<a href="https://developer.apple.com/swift"><img alt="Swift5" src="https://img.shields.io/badge/language-Swift5-orange.svg"/></a>
<a href="https://github.com/ra1028/Carbon/releases/latest"><img alt="Release" src="https://img.shields.io/github/release/ra1028/Carbon.svg"/></a>
<a href="https://cocoapods.org/pods/Carbon"><img alt="CocoaPods" src="https://img.shields.io/cocoapods/v/Carbon.svg"/></a>
<a href="https://github.com/Carthage/Carthage"><img alt="Carthage" src="https://img.shields.io/badge/carthage-compatible-yellow.svg"/></a>
Expand Down Expand Up @@ -484,4 +484,4 @@ Libraries for list UIs using diffing algorithm that I have sincerely ❤️ and

## License

Carbon is released under the [Apache 2.0 License](https://github.com/ra1028/Carbon/blob/master/LICENSE).
Carbon is released under the [Apache 2.0 License](https://github.com/ra1028/Carbon/blob/master/LICENSE).
4 changes: 2 additions & 2 deletions Sources/Adapters/UICollectionViewAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ open class UICollectionViewAdapter: NSObject, Adapter {

public extension UICollectionViewAdapter {
/// The configuration for the classes of elements in `UICollectionView`.
public struct Config {
struct Config {
/// The default configuration.
public static var `default` = Config()

Expand Down Expand Up @@ -67,7 +67,7 @@ public extension UICollectionViewAdapter {

public extension UICollectionViewAdapter {
/// Context when cell is selected.
public struct SelectionContext {
struct SelectionContext {
/// A collection view of the selected cell.
public var collectionView: UICollectionView

Expand Down
4 changes: 2 additions & 2 deletions Sources/Adapters/UITableViewAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ open class UITableViewAdapter: NSObject, Adapter {

public extension UITableViewAdapter {
/// The configuration for the classes of elements in `UITableView`.
public struct Config {
struct Config {
/// The default configuration.
public static var `default` = Config()

Expand Down Expand Up @@ -64,7 +64,7 @@ public extension UITableViewAdapter {

public extension UITableViewAdapter {
/// Context when cell is selected.
public struct SelectionContext {
struct SelectionContext {
/// A table view of the selected cell.
public var tableView: UITableView

Expand Down
6 changes: 3 additions & 3 deletions Sources/Internal/ComponentContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ internal protocol ComponentContainer: class {
}

internal extension ComponentContainer {
internal func contentWillDisplay() {
func contentWillDisplay() {
guard let content = renderedContent else { return }

renderedComponent?.contentWillDisplay(content)
}

internal func contentDidEndDisplay() {
func contentDidEndDisplay() {
guard let content = renderedContent else { return }

renderedComponent?.contentDidEndDisplay(content)
}

internal func render(component: AnyComponent) {
func render(component: AnyComponent) {
switch (renderedContent, renderedComponent) {
case (let content?, let renderedComponent?) where !renderedComponent.shouldRender(next: component, in: content):
break
Expand Down
1 change: 0 additions & 1 deletion XCConfigs/Carbon.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ DYLIB_CURRENT_VERSION = 1
DYLIB_INSTALL_NAME_BASE = @rpath
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks @loader_path/Frameworks @loader_path/../Frameworks
DEFINES_MODULE = NO
APPLICATION_EXTENSION_API_ONLY = YES
2 changes: 1 addition & 1 deletion docs/Adapters.html
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<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-18)</p>
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.4</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/Changesets.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<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-18)</p>
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.4</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/Classes/Renderer.html
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ <h4>Parameters</h4>
</article>
</div>
<section class="footer">
<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-18)</p>
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.4</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/Classes/UICollectionComponentReusableView.html
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<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-18)</p>
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.4</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
6 changes: 3 additions & 3 deletions docs/Classes/UICollectionViewAdapter.html
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ <h4>Parameters</h4>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Config</span></code></pre>
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">Config</span></code></pre>

</div>
</div>
Expand Down Expand Up @@ -410,7 +410,7 @@ <h4>Declaration</h4>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SelectionContext</span></code></pre>
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">SelectionContext</span></code></pre>

</div>
</div>
Expand Down Expand Up @@ -676,7 +676,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<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-18)</p>
<p>&copy; 2019 <a class="link" href="https://github.com/ra1028" target="_blank" rel="external">Ryo Aoyama</a>. All rights reserved. (Last updated: 2019-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.4</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
Expand Down
Loading

0 comments on commit 9acc419

Please sign in to comment.