From 9d1b7c186f1c554a6693b9c581858e130884b6b7 Mon Sep 17 00:00:00 2001 From: Mathias Claassen Date: Tue, 11 Jun 2019 14:18:54 -0300 Subject: [PATCH] Update for Swift 5 and Eureka 5.0 (#15) --- .swift-version | 2 +- .travis.yml | 6 ++-- CHANGELOG.md | 8 ++++- Cartfile | 2 +- Cartfile.resolved | 2 +- CreditCardRow.podspec | 7 ++-- CreditCardRow.xcodeproj/project.pbxproj | 33 +++++++++-------- .../xcschemes/CreditCardRow.xcscheme | 2 +- Example.xcodeproj/project.pbxproj | 35 +++++++++---------- Example/Example/AppDelegate.swift | 2 +- README.md | 8 ++--- Sources/CreditCardCell.swift | 2 +- Sources/String+CreditCardRow.swift | 2 +- Tests/CreditCardRowTests.swift | 2 +- 14 files changed, 57 insertions(+), 56 deletions(-) diff --git a/.swift-version b/.swift-version index 5186d07..819e07a 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.0 +5.0 diff --git a/.travis.yml b/.travis.yml index e168ee9..0eb4a9d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,13 @@ language: objective-c -osx_image: xcode9 +osx_image: xcode10.2 env: - - DESTINATION="OS=11.0,name=iPhone 7" SCHEME="CreditCardRow" SDK=iphonesimulator + - DESTINATION="OS=12.0,name=iPhone X" SCHEME="CreditCardRow" SDK=iphonesimulator before_install: - brew update - brew outdated carthage || brew upgrade carthage - carthage update --platform iOS -- gem install xcpretty --no-rdoc --no-ri --no-document --quiet +- gem install xcpretty --quiet script: - xcodebuild clean build -project CreditCardRow.xcodeproj -scheme "$SCHEME" -sdk "$SDK" diff --git a/CHANGELOG.md b/CHANGELOG.md index 44eb3ba..d2c0924 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,14 @@ # Change Log All notable changes to CreditCardRow will be documented in this file. +### [3.2.0](https://github.com/EurekaCommunity/GenericPasswordRow/releases/tag/3.2.0) + + +* Adds support for Eureka ~> 5.x +* Swift 5 support + ### [3.1.0](https://github.com/EurekaCommunity/GenericPasswordRow/releases/tag/3.1.0) - + * Adds support for Eureka ~> 4.x diff --git a/Cartfile b/Cartfile index ec2bbb1..299dd1b 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1 @@ -github "xmartlabs/Eureka" ~> 4.0 +github "xmartlabs/Eureka" ~> 5.0 diff --git a/Cartfile.resolved b/Cartfile.resolved index ea6d2cc..cc733b0 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1 +1 @@ -github "xmartlabs/Eureka" "4.2.0" +github "xmartlabs/Eureka" "5.0.0" diff --git a/CreditCardRow.podspec b/CreditCardRow.podspec index 44a70c6..d871f4d 100644 --- a/CreditCardRow.podspec +++ b/CreditCardRow.podspec @@ -1,18 +1,19 @@ Pod::Spec.new do |s| s.name = "CreditCardRow" - s.version = "3.1.0" + s.version = "3.2.0" s.summary = "An Eureka row that allows the user to input a credit card number with optional CVC and expiration date." s.homepage = "https://github.com/EurekaCommunity/CreditCardRow" s.license = { type: 'MIT', file: 'LICENSE' } s.author = { "Xmartlabs SRL" => "swift@xmartlabs.com" } s.source = { git: "https://github.com/EurekaCommunity/CreditCardRow.git", tag: s.version.to_s } s.social_media_url = 'https://twitter.com/xmartlabs' - s.ios.deployment_target = '8.0' + s.ios.deployment_target = '9.3' s.requires_arc = true s.ios.source_files = 'Sources/**/*.swift' s.resource_bundles = { 'CreditCardRow' => ['Sources/CreditCardCell.xib'] } s.ios.frameworks = 'UIKit', 'Foundation' - s.dependency 'Eureka', '~> 4.0' + s.dependency 'Eureka', '~> 5.0' + s.swift_version = '5.0' end diff --git a/CreditCardRow.xcodeproj/project.pbxproj b/CreditCardRow.xcodeproj/project.pbxproj index 05bfa59..eb7af32 100644 --- a/CreditCardRow.xcodeproj/project.pbxproj +++ b/CreditCardRow.xcodeproj/project.pbxproj @@ -38,7 +38,7 @@ 8F7E92301D78BA29002BEFC3 /* CreditCardRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreditCardRow.swift; sourceTree = ""; }; 8F9B3A091D7DBA12005F8273 /* String+CreditCardRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+CreditCardRow.swift"; sourceTree = ""; }; 8FD114E51D79F8B6006976C8 /* CreditCardCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CreditCardCell.xib; sourceTree = ""; }; - CB3F7D831F8BF41900C856E5 /* CreditCardRowTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CreditCardRowTests.swift; path = ExampleUITests/CreditCardRowTests.swift; sourceTree = SOURCE_ROOT; }; + CB3F7D831F8BF41900C856E5 /* CreditCardRowTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CreditCardRowTests.swift; path = Tests/CreditCardRowTests.swift; sourceTree = SOURCE_ROOT; }; CB3F7D841F8BF41900C856E5 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ExampleUITests/Info.plist; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ @@ -178,24 +178,25 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0940; + LastUpgradeCheck = 1020; TargetAttributes = { 28F8287C1C494B2C00330CF4 = { CreatedOnToolsVersion = 7.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; }; 28F828861C494B2C00330CF4 = { CreatedOnToolsVersion = 7.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; }; }; }; buildConfigurationList = 28F828771C494B2C00330CF4 /* Build configuration list for PBXProject "CreditCardRow" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 28F828731C494B2C00330CF4; productRefGroup = 28F8287E1C494B2C00330CF4 /* Products */; @@ -279,6 +280,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -322,7 +324,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -338,6 +340,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -375,7 +378,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; @@ -401,13 +404,12 @@ ); INFOPLIST_FILE = CreditCardRow/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.CreditCardRow; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -425,13 +427,12 @@ ); INFOPLIST_FILE = CreditCardRow/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.CreditCardRow; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -444,8 +445,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.CreditCardRowTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -457,8 +457,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.CreditCardRowTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/CreditCardRow.xcodeproj/xcshareddata/xcschemes/CreditCardRow.xcscheme b/CreditCardRow.xcodeproj/xcshareddata/xcschemes/CreditCardRow.xcscheme index 9adfd56..b43c0f5 100644 --- a/CreditCardRow.xcodeproj/xcshareddata/xcschemes/CreditCardRow.xcscheme +++ b/CreditCardRow.xcodeproj/xcshareddata/xcschemes/CreditCardRow.xcscheme @@ -1,6 +1,6 @@ Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } diff --git a/README.md b/README.md index d7b0593..872147d 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,6 @@ By [Xmartlabs SRL](http://xmartlabs.com). -The master branch is in Swift 4. Use release 1.0.0 for Swift 2 or release 2.* for Swift 3. - ## Usage ```swift @@ -53,8 +51,8 @@ class ViewController: FormViewController { ## Requirements -* iOS 8.0+ -* Xcode 9.0+ +* iOS 9.3+ +* Xcode 10.2+ ## Getting involved @@ -83,7 +81,7 @@ Follow these steps to run Example project: To install CreditCardRow, simply add the following line to your Podfile: ```ruby -pod 'CreditCardRow', '~> 3.0' +pod 'CreditCardRow', '~> 3.2' ``` #### Carthage diff --git a/Sources/CreditCardCell.swift b/Sources/CreditCardCell.swift index 5e3d258..3a19e51 100644 --- a/Sources/CreditCardCell.swift +++ b/Sources/CreditCardCell.swift @@ -44,7 +44,7 @@ open class CreditCardCell: Cell, UITextFieldDelegate, CellType { fileprivate var previousTextFieldContent: String? fileprivate var previousSelection: UITextRange? - required public init(style: UITableViewCellStyle, reuseIdentifier: String?) { + required public init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) } diff --git a/Sources/String+CreditCardRow.swift b/Sources/String+CreditCardRow.swift index bcfb121..629d354 100644 --- a/Sources/String+CreditCardRow.swift +++ b/Sources/String+CreditCardRow.swift @@ -21,7 +21,7 @@ public extension String { subscript (r: Range) -> String { let start = index(startIndex, offsetBy: r.lowerBound) let end = index(start, offsetBy: r.upperBound - r.lowerBound) - return String(self[Range(start ..< end)]) + return String(self[start..