Skip to content

Commit 4daf229

Browse files
Vyazovoyheiberg
authored andcommitted
Support swift 4.2 (#4)
* Update code to swift 4.2 * Update test project to swift 4.2 * Update Travis config * Fix Travis pod update * Temporary allow warnings to pass `Quick` pod warning `WARN | xcodebuild: Quick/Sources/Quick/Behavior.swift:7:21: warning: static declarations are implicitly 'final'; use 'public' instead of 'open'`
1 parent 4fd0b61 commit 4daf229

10 files changed

Lines changed: 17 additions & 15 deletions

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
osx_image: xcode9.4
1+
osx_image: xcode10
22
language: swift
33
script:
4+
- pod repo update
45
- pod install --project-directory=Examples
56
- set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Examples/SimpleSourceExample.xcworkspace -scheme SimpleSource-Unit-Tests -destination 'name=iPhone 8' ONLY_ACTIVE_ARCH=YES | xcpretty
6-
- pod lib lint
7+
- pod lib lint --allow-warnings
78
after_success:
89
- bash <(curl -s https://codecov.io/bash) -J 'SimpleSource'

Examples/SimpleSourceExample.xcodeproj/project.pbxproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@
291291
TargetAttributes = {
292292
C424C2641E3B4B2900CEE8C0 = {
293293
CreatedOnToolsVersion = 8.2;
294+
LastSwiftMigration = 1000;
294295
ProvisioningStyle = Automatic;
295296
};
296297
};
@@ -538,7 +539,7 @@
538539
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
539540
PRODUCT_BUNDLE_IDENTIFIER = com.squarespace.SimpleSourceExample;
540541
PRODUCT_NAME = "$(TARGET_NAME)";
541-
SWIFT_VERSION = 4.0;
542+
SWIFT_VERSION = 4.2;
542543
};
543544
name = Debug;
544545
};
@@ -551,7 +552,7 @@
551552
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
552553
PRODUCT_BUNDLE_IDENTIFIER = com.squarespace.SimpleSourceExample;
553554
PRODUCT_NAME = "$(TARGET_NAME)";
554-
SWIFT_VERSION = 4.0;
555+
SWIFT_VERSION = 4.2;
555556
};
556557
name = Release;
557558
};

Examples/SimpleSourceExample/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import UIKit
44
class AppDelegate: UIResponder, UIApplicationDelegate {
55
var window: UIWindow?
66

7-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
7+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
88
return true
99
}
1010
}

Examples/SimpleSourceExample/HeaderColorGridViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ final class HeaderColorGridViewController: UICollectionViewController {
6060
let configureHeader = ColorGridHeader.configureHeader(dataSource: dataSource)
6161
viewFactory.registerSupplementaryView(
6262
method: .dynamic,
63-
kind: UICollectionElementKindSectionHeader,
63+
kind: UICollectionView.elementKindSectionHeader,
6464
reuseIdentifier: ColorGridHeader.reuseIdentifier,
6565
in: collectionView,
6666
configuration: configureHeader)

Examples/SimpleSourceExample/ItemListTableViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ final class ItemListTableViewController: UITableViewController {
7878

7979
// This method is part of UITableViewDelegate, so it will not be provided or proxied by the SimpleSource data source.
8080
// SimpleSource only implements methods from UITableViewDataSource.
81-
override func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCellEditingStyle {
81+
override func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle {
8282
return .delete
8383
}
8484

@@ -98,7 +98,7 @@ final class ItemListTableViewController: UITableViewController {
9898
// MARK: Editing
9999

100100
extension ItemListTableViewController: TableViewEditingDelegate {
101-
func editing(tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
101+
func editing(tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
102102
dataSource.sections[0].items.remove(at: indexPath.item)
103103
}
104104
}

SimpleSource.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Pod::Spec.new do |s|
22
s.name = 'SimpleSource'
3-
s.version = '1.0.1'
3+
s.version = '2.0.0'
44
s.summary = 'Composable, easy to use data sources for UITableView and UICollectionView.'
55
s.homepage = 'https://github.com/Squarespace/simple-source'
66
s.license = { :type => 'Apache', :file => 'LICENSE' }
77
s.authors = { 'Morten Heiberg' => 'mheiberg@squarespace.com', 'Thor Frolich' => 'tfrolich@squarespace.com' }
88
s.platform = :ios, '9.0'
9-
s.swift_version = '4.0'
9+
s.swift_version = '4.2'
1010
s.source = { :git => 'https://github.com/Squarespace/simple-source.git', :tag => s.version }
1111
s.source_files = 'Sources/**/*.{h,m,swift}'
12-
s.dependency 'Dwifft', '0.7'
12+
s.dependency 'Dwifft', '~> 0.9.0'
1313

1414
s.test_spec 'Tests' do |test_spec|
1515
test_spec.resource = 'Tests/Model/*.xcdatamodeld'

Sources/UITableView/TableViewDataSource.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ open class TableViewDataSource<DS, VF>: NSObject, UITableViewDataSource where DS
8787
return editingDelegate?.editing(tableView: tableView, canEditRowAt: indexPath) ?? false
8888
}
8989

90-
public func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
90+
public func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
9191
editingDelegate?.editing(tableView: tableView, commit: editingStyle, forRowAt: indexPath)
9292
}
9393

Sources/UITableView/TableViewEditingDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import UIKit
1212
/// Set the `editingDelegate` property of your `TableViewDataSource` to control editing.
1313
public protocol TableViewEditingDelegate: class {
1414
func editing(tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool
15-
func editing(tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath)
15+
func editing(tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath)
1616
}
1717

1818
extension TableViewEditingDelegate {

Sources/UITableView/TableViewFactory.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import UIKit
33
public enum TableViewRegistrationMethod {
44
case classBased(AnyClass?)
55
case nibBased(UINib?)
6-
case style(UITableViewCellStyle)
6+
case style(UITableViewCell.CellStyle)
77
case dynamic
88
}
99

Sources/UITableView/UITableView+Updates.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ extension UITableView {
55
return { [weak self] _ in self?.reloadData() }
66
}
77

8-
public func defaultViewUpdate(with animation: UITableViewRowAnimation = .fade) -> IndexedUpdateHandler.Observer {
8+
public func defaultViewUpdate(with animation: UITableView.RowAnimation = .fade) -> IndexedUpdateHandler.Observer {
99
return { [weak self] update in
1010
guard let _ = self?.window else {
1111
self?.reloadData()

0 commit comments

Comments
 (0)