Skip to content

Commit a01d989

Browse files
author
Giulio
authored
Merge pull request #35 from giulio92/feature/xcode-10
Xcode 10 & Swift 4.2 support
2 parents efeff05 + aada53a commit a01d989

8 files changed

Lines changed: 57 additions & 40 deletions

File tree

.swiftlint.yml

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,41 @@
1-
# rule identifiers to exclude from running
2-
disabled_rules:
3-
- line_length
4-
5-
# some rules are only opt-in
61
opt_in_rules:
7-
# Find all the available rules by running:
8-
# swiftlint rules
9-
2+
- anyobject_protocol
3+
- closure_spacing
4+
- contains_over_first_not_nil
5+
- convenience_type
6+
- empty_count
7+
- empty_string
8+
- empty_xctest_method
9+
- explicit_init
10+
- fallthrough
11+
- fatal_error_message
12+
- file_name
13+
- first_where
14+
- force_unwrapping
15+
- implicit_return
16+
- let_var_whitespace
17+
- literal_expression_end_indentation
18+
- operator_usage_whitespace
19+
- overridden_super_call
20+
- override_in_extension
21+
- private_action
22+
- private_outlet
23+
- prohibited_super_call
24+
- single_test_class
25+
- sorted_imports
26+
- toggle_bool
27+
- unused_import
28+
- unused_private_declaration
1029

11-
# paths to include during linting. `--path` is ignored if present.
1230
included:
13-
1431

15-
# paths to ignore during linting. Takes precedence over `included`.
16-
excluded:
17-
18-
19-
# configurable rules can be customized from this configuration file
20-
# binary rules can set their severity level
2132
force_cast: warning
33+
34+
identifier_name:
35+
min_length: 2
36+
37+
line_length: 160
38+
39+
disabled_rules:
40+
- nesting
41+
- custom_rules

Classes/GLCollectionTableViewCell.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ class GLIndexedCollectionViewFlowLayout: UICollectionViewFlowLayout {
108108
// if statement below. This will fix the "last cell" issue.
109109
let discardableScrollingElementsFrame: CGFloat = collectionView.contentOffset.x + (collectionView.frame.size.width / 2)
110110

111-
if (cellLayoutAttribute.center.x <= discardableScrollingElementsFrame && velocity.x > 0) || (cellLayoutAttribute.center.x >= discardableScrollingElementsFrame && velocity.x < 0) {
111+
if (cellLayoutAttribute.center.x <= discardableScrollingElementsFrame && velocity.x > 0) ||
112+
(cellLayoutAttribute.center.x >= discardableScrollingElementsFrame && velocity.x < 0) {
112113
return
113114
}
114115

@@ -157,7 +158,7 @@ class GLCollectionTableViewCell: UITableViewCell {
157158
/// Default value is `nil`, since `Bool` is `Optional`.
158159
var collectionViewPaginatedScroll: Bool?
159160

160-
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
161+
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
161162
super.init(style: style, reuseIdentifier: reuseIdentifier)
162163

163164
collectionFlowLayout = GLIndexedCollectionViewFlowLayout()

Classes/GLTableCollectionViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ final class GLTableCollectionViewController: UITableViewController, UICollection
130130
cell = GLCollectionTableViewCell(style: .default, reuseIdentifier: GLTableCollectionViewController.tableCellID + indexPath.section.description)
131131

132132
// Configure the cell...
133-
cell!.selectionStyle = .none
134-
cell!.collectionViewPaginatedScroll = paginationEnabled
133+
cell?.selectionStyle = .none
134+
cell?.collectionViewPaginatedScroll = paginationEnabled
135135
}
136136

137137
return cell!

GLTableCollectionView.xcodeproj/project.pbxproj

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@
112112
isa = PBXNativeTarget;
113113
buildConfigurationList = 747CF9161DE6EB010051A5FF /* Build configuration list for PBXNativeTarget "GLTableCollectionView" */;
114114
buildPhases = (
115+
EF73511D1E8E9B5800F73EDB /* SwiftLint */,
115116
747CF8F51DE6EB010051A5FF /* Sources */,
116117
747CF8F61DE6EB010051A5FF /* Frameworks */,
117118
747CF8F71DE6EB010051A5FF /* Resources */,
118-
EF73511D1E8E9B5800F73EDB /* SwiftLint */,
119119
);
120120
buildRules = (
121121
);
@@ -157,12 +157,12 @@
157157
TargetAttributes = {
158158
747CF8F81DE6EB010051A5FF = {
159159
CreatedOnToolsVersion = 8.0;
160-
LastSwiftMigration = 0900;
160+
LastSwiftMigration = 1010;
161161
ProvisioningStyle = Manual;
162162
};
163163
747CF90C1DE6EB010051A5FF = {
164164
CreatedOnToolsVersion = 8.0;
165-
LastSwiftMigration = 0900;
165+
LastSwiftMigration = 1010;
166166
ProvisioningStyle = Manual;
167167
TestTargetID = 747CF8F81DE6EB010051A5FF;
168168
};
@@ -221,7 +221,7 @@
221221
);
222222
runOnlyForDeploymentPostprocessing = 0;
223223
shellPath = /bin/sh;
224-
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi";
224+
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
225225
};
226226
/* End PBXShellScriptBuildPhase section */
227227

@@ -426,8 +426,7 @@
426426
PRODUCT_NAME = "$(TARGET_NAME)";
427427
PROVISIONING_PROFILE = "";
428428
PROVISIONING_PROFILE_SPECIFIER = "";
429-
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
430-
SWIFT_VERSION = 4.0;
429+
SWIFT_VERSION = 4.2;
431430
};
432431
name = Debug;
433432
};
@@ -464,8 +463,7 @@
464463
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
465464
PRODUCT_BUNDLE_IDENTIFIER = giuliolombardo.GLTableCollectionView;
466465
PRODUCT_NAME = "$(TARGET_NAME)";
467-
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
468-
SWIFT_VERSION = 4.0;
466+
SWIFT_VERSION = 4.2;
469467
};
470468
name = Release;
471469
};
@@ -481,8 +479,7 @@
481479
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
482480
PRODUCT_BUNDLE_IDENTIFIER = giuliolombardo.GLTableCollectionViewTests;
483481
PRODUCT_NAME = "$(TARGET_NAME)";
484-
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
485-
SWIFT_VERSION = 4.0;
482+
SWIFT_VERSION = 4.2;
486483
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GLTableCollectionView.app/GLTableCollectionView";
487484
};
488485
name = Debug;
@@ -499,8 +496,7 @@
499496
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
500497
PRODUCT_BUNDLE_IDENTIFIER = giuliolombardo.GLTableCollectionViewTests;
501498
PRODUCT_NAME = "$(TARGET_NAME)";
502-
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
503-
SWIFT_VERSION = 4.0;
499+
SWIFT_VERSION = 4.2;
504500
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GLTableCollectionView.app/GLTableCollectionView";
505501
};
506502
name = Release;

GLTableCollectionView/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import UIKit
3333
final class AppDelegate: UIResponder, UIApplicationDelegate {
3434
var window: UIWindow?
3535

36-
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
36+
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
3737
// Override point for customization after application launch.
3838
return true
3939
}

GLTableCollectionView/Base.lproj/LaunchScreen.storyboard

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Ik1-Jh-kcr">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Ik1-Jh-kcr">
33
<device id="retina4_7" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
77
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
99
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
1010
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
1111
</dependencies>

GLTableCollectionView/Base.lproj/Main.storyboard

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="ClH-cz-IEW">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="ClH-cz-IEW">
33
<device id="retina4_7" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
77
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
99
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
1010
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
1111
</dependencies>

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
|`master`|[![BuddyBuild](https://dashboard.buddybuild.com/api/statusImage?appID=592889ed482e8d00016f99eb&branch=master&build=latest)](https://dashboard.buddybuild.com/apps/592889ed482e8d00016f99eb/build/latest?branch=master)|
1010
|`develop`|[![BuddyBuild](https://dashboard.buddybuild.com/api/statusImage?appID=592889ed482e8d00016f99eb&branch=develop&build=latest)](https://dashboard.buddybuild.com/apps/592889ed482e8d00016f99eb/build/latest?branch=develop)|
1111

12-
![Language](https://img.shields.io/badge/language-Swift%204.x-orange.svg)
12+
![Language](https://img.shields.io/badge/language-Swift%204.2-orange.svg)
1313
![Supported platforms](https://img.shields.io/badge/platform-iOS-lightgrey.svg)
1414
[![codebeat badge](https://codebeat.co/badges/5a29ccd4-fda0-45d1-ae57-e7158e01449a)](https://codebeat.co/projects/github-com-giulio92-gltablecollectionview)
1515
[![license](https://img.shields.io/github/license/giulio92/GLTableCollectionView.svg)](https://github.com/giulio92/GLTableCollectionView/blob/master/LICENSE.txt)
@@ -47,8 +47,8 @@ var paginationEnabled: Bool = true
4747
</p>
4848

4949
## Requirements
50-
- Xcode 9.0+
51-
- Swift 4.0+
50+
- Xcode 10.0+
51+
- Swift 4.2+
5252
- iOS 9.0+
5353
- [SwiftLint](https://github.com/realm/SwiftLint) (Optional, but _highly_ suggested)
5454

0 commit comments

Comments
 (0)