From 0d514d04b55c9bb2f6216ca8648bf85c289b06a7 Mon Sep 17 00:00:00 2001 From: Giulio Lombardo Date: Thu, 20 Dec 2018 21:07:59 +0100 Subject: [PATCH 1/5] Update Swift syntax to 4.2 --- Classes/GLCollectionTableViewCell.swift | 2 +- .../project.pbxproj | 20 ++++++++----------- GLTableCollectionView/AppDelegate.swift | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Classes/GLCollectionTableViewCell.swift b/Classes/GLCollectionTableViewCell.swift index 00c539d..2cc1b3b 100644 --- a/Classes/GLCollectionTableViewCell.swift +++ b/Classes/GLCollectionTableViewCell.swift @@ -157,7 +157,7 @@ class GLCollectionTableViewCell: UITableViewCell { /// Default value is `nil`, since `Bool` is `Optional`. var collectionViewPaginatedScroll: Bool? - override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) collectionFlowLayout = GLIndexedCollectionViewFlowLayout() diff --git a/GLTableCollectionView.xcodeproj/project.pbxproj b/GLTableCollectionView.xcodeproj/project.pbxproj index a4237f0..b961c4b 100644 --- a/GLTableCollectionView.xcodeproj/project.pbxproj +++ b/GLTableCollectionView.xcodeproj/project.pbxproj @@ -112,10 +112,10 @@ isa = PBXNativeTarget; buildConfigurationList = 747CF9161DE6EB010051A5FF /* Build configuration list for PBXNativeTarget "GLTableCollectionView" */; buildPhases = ( + EF73511D1E8E9B5800F73EDB /* SwiftLint */, 747CF8F51DE6EB010051A5FF /* Sources */, 747CF8F61DE6EB010051A5FF /* Frameworks */, 747CF8F71DE6EB010051A5FF /* Resources */, - EF73511D1E8E9B5800F73EDB /* SwiftLint */, ); buildRules = ( ); @@ -157,12 +157,12 @@ TargetAttributes = { 747CF8F81DE6EB010051A5FF = { CreatedOnToolsVersion = 8.0; - LastSwiftMigration = 0900; + LastSwiftMigration = 1010; ProvisioningStyle = Manual; }; 747CF90C1DE6EB010051A5FF = { CreatedOnToolsVersion = 8.0; - LastSwiftMigration = 0900; + LastSwiftMigration = 1010; ProvisioningStyle = Manual; TestTargetID = 747CF8F81DE6EB010051A5FF; }; @@ -221,7 +221,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi"; + 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"; }; /* End PBXShellScriptBuildPhase section */ @@ -426,8 +426,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -464,8 +463,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = giuliolombardo.GLTableCollectionView; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -481,8 +479,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = giuliolombardo.GLTableCollectionViewTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GLTableCollectionView.app/GLTableCollectionView"; }; name = Debug; @@ -499,8 +496,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = giuliolombardo.GLTableCollectionViewTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GLTableCollectionView.app/GLTableCollectionView"; }; name = Release; diff --git a/GLTableCollectionView/AppDelegate.swift b/GLTableCollectionView/AppDelegate.swift index 1a5e4a7..00681e0 100644 --- a/GLTableCollectionView/AppDelegate.swift +++ b/GLTableCollectionView/AppDelegate.swift @@ -33,7 +33,7 @@ import UIKit final class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } From ec41337b31b4b1d380c4f6c8372db5ca4d8c002d Mon Sep 17 00:00:00 2001 From: Giulio Lombardo Date: Thu, 20 Dec 2018 21:08:09 +0100 Subject: [PATCH 2/5] Update .storyboard files --- GLTableCollectionView/Base.lproj/LaunchScreen.storyboard | 4 ++-- GLTableCollectionView/Base.lproj/Main.storyboard | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GLTableCollectionView/Base.lproj/LaunchScreen.storyboard b/GLTableCollectionView/Base.lproj/LaunchScreen.storyboard index 58fdedc..2ca876b 100644 --- a/GLTableCollectionView/Base.lproj/LaunchScreen.storyboard +++ b/GLTableCollectionView/Base.lproj/LaunchScreen.storyboard @@ -1,11 +1,11 @@ - + - + diff --git a/GLTableCollectionView/Base.lproj/Main.storyboard b/GLTableCollectionView/Base.lproj/Main.storyboard index 283f379..5ef0231 100644 --- a/GLTableCollectionView/Base.lproj/Main.storyboard +++ b/GLTableCollectionView/Base.lproj/Main.storyboard @@ -1,11 +1,11 @@ - + - + From 4f60708ef643620a579b719f43f3b3ef79c9b423 Mon Sep 17 00:00:00 2001 From: Giulio Lombardo Date: Thu, 20 Dec 2018 21:10:25 +0100 Subject: [PATCH 3/5] Update SwiftLint rules --- .swiftlint.yml | 52 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index 92ae03e..03ebbb5 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,21 +1,41 @@ -# rule identifiers to exclude from running -disabled_rules: - - line_length - -# some rules are only opt-in opt_in_rules: -# Find all the available rules by running: -# swiftlint rules - + - anyobject_protocol + - closure_spacing + - contains_over_first_not_nil + - convenience_type + - empty_count + - empty_string + - empty_xctest_method + - explicit_init + - fallthrough + - fatal_error_message + - file_name + - first_where + - force_unwrapping + - implicit_return + - let_var_whitespace + - literal_expression_end_indentation + - operator_usage_whitespace + - overridden_super_call + - override_in_extension + - private_action + - private_outlet + - prohibited_super_call + - single_test_class + - sorted_imports + - toggle_bool + - unused_import + - unused_private_declaration -# paths to include during linting. `--path` is ignored if present. included: - -# paths to ignore during linting. Takes precedence over `included`. -excluded: - - -# configurable rules can be customized from this configuration file -# binary rules can set their severity level force_cast: warning + +identifier_name: + min_length: 2 + +line_length: 160 + +disabled_rules: + - nesting + - custom_rules From e039966875efa8dff84e56444d8fd6106d4b0e7e Mon Sep 17 00:00:00 2001 From: Giulio Lombardo Date: Thu, 20 Dec 2018 21:13:29 +0100 Subject: [PATCH 4/5] Reduce warnings --- Classes/GLCollectionTableViewCell.swift | 3 ++- Classes/GLTableCollectionViewController.swift | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Classes/GLCollectionTableViewCell.swift b/Classes/GLCollectionTableViewCell.swift index 2cc1b3b..1444c8c 100644 --- a/Classes/GLCollectionTableViewCell.swift +++ b/Classes/GLCollectionTableViewCell.swift @@ -108,7 +108,8 @@ class GLIndexedCollectionViewFlowLayout: UICollectionViewFlowLayout { // if statement below. This will fix the "last cell" issue. let discardableScrollingElementsFrame: CGFloat = collectionView.contentOffset.x + (collectionView.frame.size.width / 2) - if (cellLayoutAttribute.center.x <= discardableScrollingElementsFrame && velocity.x > 0) || (cellLayoutAttribute.center.x >= discardableScrollingElementsFrame && velocity.x < 0) { + if (cellLayoutAttribute.center.x <= discardableScrollingElementsFrame && velocity.x > 0) || + (cellLayoutAttribute.center.x >= discardableScrollingElementsFrame && velocity.x < 0) { return } diff --git a/Classes/GLTableCollectionViewController.swift b/Classes/GLTableCollectionViewController.swift index 69019cf..6e8363d 100644 --- a/Classes/GLTableCollectionViewController.swift +++ b/Classes/GLTableCollectionViewController.swift @@ -130,8 +130,8 @@ final class GLTableCollectionViewController: UITableViewController, UICollection cell = GLCollectionTableViewCell(style: .default, reuseIdentifier: GLTableCollectionViewController.tableCellID + indexPath.section.description) // Configure the cell... - cell!.selectionStyle = .none - cell!.collectionViewPaginatedScroll = paginationEnabled + cell?.selectionStyle = .none + cell?.collectionViewPaginatedScroll = paginationEnabled } return cell! From aada53abd8db568a5389cac07b6ccb9afed76109 Mon Sep 17 00:00:00 2001 From: Giulio Date: Thu, 20 Dec 2018 21:14:57 +0100 Subject: [PATCH 5/5] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9d95376..2c49535 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ |`master`|[![BuddyBuild](https://dashboard.buddybuild.com/api/statusImage?appID=592889ed482e8d00016f99eb&branch=master&build=latest)](https://dashboard.buddybuild.com/apps/592889ed482e8d00016f99eb/build/latest?branch=master)| |`develop`|[![BuddyBuild](https://dashboard.buddybuild.com/api/statusImage?appID=592889ed482e8d00016f99eb&branch=develop&build=latest)](https://dashboard.buddybuild.com/apps/592889ed482e8d00016f99eb/build/latest?branch=develop)| -![Language](https://img.shields.io/badge/language-Swift%204.x-orange.svg) +![Language](https://img.shields.io/badge/language-Swift%204.2-orange.svg) ![Supported platforms](https://img.shields.io/badge/platform-iOS-lightgrey.svg) [![codebeat badge](https://codebeat.co/badges/5a29ccd4-fda0-45d1-ae57-e7158e01449a)](https://codebeat.co/projects/github-com-giulio92-gltablecollectionview) [![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

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