diff --git a/.swift-version b/.swift-version index 5186d07..bf77d54 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.0 +4.2 diff --git a/LeadKitAdditions.xcodeproj/project.pbxproj b/LeadKitAdditions.xcodeproj/project.pbxproj index 86ab041..a0fca3e 100644 --- a/LeadKitAdditions.xcodeproj/project.pbxproj +++ b/LeadKitAdditions.xcodeproj/project.pbxproj @@ -27,6 +27,7 @@ 67C2A41D20725359000A5682 /* LabelTableViewCell+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67C2A41C20725359000A5682 /* LabelTableViewCell+Extensions.swift */; }; 67CF05AA206E9880009A2AB9 /* PinLayoutCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67CF05A9206E9880009A2AB9 /* PinLayoutCell.swift */; }; 67CF05B0206E99DF009A2AB9 /* PinLayoutTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67CF05AF206E99DF009A2AB9 /* PinLayoutTableViewCell.swift */; }; + 67D6041821627600002DAF5B /* LegacyConfigurableController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67D6041721627600002DAF5B /* LegacyConfigurableController.swift */; }; A6CFB8D91F5024A500A42CC2 /* Error+NetworkingExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6CFB8D81F5024A500A42CC2 /* Error+NetworkingExtensions.swift */; }; B326804BA6CC8B8BB136A46A /* Pods_LeadKitAdditions_LeadKitAdditions_iOS_Extensions.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CFD5627139CAB27705F75C07 /* Pods_LeadKitAdditions_LeadKitAdditions_iOS_Extensions.framework */; }; CAE698E81E968820000394B0 /* LeadKitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = CAE698E61E968820000394B0 /* LeadKitAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -84,6 +85,7 @@ 67C2A41C20725359000A5682 /* LabelTableViewCell+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LabelTableViewCell+Extensions.swift"; sourceTree = ""; }; 67CF05A9206E9880009A2AB9 /* PinLayoutCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinLayoutCell.swift; sourceTree = ""; }; 67CF05AF206E99DF009A2AB9 /* PinLayoutTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinLayoutTableViewCell.swift; sourceTree = ""; }; + 67D6041721627600002DAF5B /* LegacyConfigurableController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyConfigurableController.swift; sourceTree = ""; }; 7B7F57C5E5275C4D8DC71992 /* Pods_LeadKitAdditions.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LeadKitAdditions.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9D549FA5A7579702358E07DF /* Pods-LeadKitAdditions-LeadKitAdditions iOS Extensions.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LeadKitAdditions-LeadKitAdditions iOS Extensions.debug.xcconfig"; path = "Pods/Target Support Files/Pods-LeadKitAdditions-LeadKitAdditions iOS Extensions/Pods-LeadKitAdditions-LeadKitAdditions iOS Extensions.debug.xcconfig"; sourceTree = ""; }; A6CFB8D81F5024A500A42CC2 /* Error+NetworkingExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Error+NetworkingExtensions.swift"; sourceTree = ""; }; @@ -305,6 +307,7 @@ children = ( 67CF05A8206E986A009A2AB9 /* Cells */, 67B4E6F4206945DC00E233EA /* ValidationService */, + 67D6041721627600002DAF5B /* LegacyConfigurableController.swift */, ); path = Protocols; sourceTree = ""; @@ -373,7 +376,6 @@ CAE698DF1E968820000394B0 /* Frameworks */, CAE698E01E968820000394B0 /* Headers */, CAE698E11E968820000394B0 /* Resources */, - 94F6E1BA5AD68C6E2F10062B /* [CP] Copy Pods Resources */, CAE6990A1E969A7A000394B0 /* Swiftlint */, ); buildRules = ( @@ -394,7 +396,6 @@ EFBD556C1EBB87100062AA63 /* Frameworks */, EFBD556D1EBB87100062AA63 /* Headers */, EFBD556E1EBB87100062AA63 /* Resources */, - 808FF5474C0E1574D405EFAF /* [CP] Copy Pods Resources */, ED69E7E91F2AD0E000C74895 /* Swiftlint */, ); buildRules = ( @@ -417,7 +418,7 @@ TargetAttributes = { CAE698E21E968820000394B0 = { CreatedOnToolsVersion = 8.3; - LastSwiftMigration = 0900; + LastSwiftMigration = 1000; ProvisioningStyle = Manual; }; EFBD556F1EBB87100062AA63 = { @@ -480,36 +481,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 808FF5474C0E1574D405EFAF /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-LeadKitAdditions-LeadKitAdditions iOS Extensions/Pods-LeadKitAdditions-LeadKitAdditions iOS Extensions-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 94F6E1BA5AD68C6E2F10062B /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-LeadKitAdditions-LeadKitAdditions iOS/Pods-LeadKitAdditions-LeadKitAdditions iOS-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; CAE6990A1E969A7A000394B0 /* Swiftlint */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -563,6 +534,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 67D6041821627600002DAF5B /* LegacyConfigurableController.swift in Sources */, 67B4E6FB20694A4200E233EA /* BaseTextFieldViewModel.swift in Sources */, ED0C340F1F2906EC00FAE9FD /* PassCodeHolderProtocol.swift in Sources */, ED0C343F1F2906EC00FAE9FD /* ValidationError.swift in Sources */, @@ -768,7 +740,7 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -792,7 +764,7 @@ PRODUCT_NAME = LeadKitAdditions; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/Podfile b/Podfile index e8c3fc9..89a22e0 100644 --- a/Podfile +++ b/Podfile @@ -9,21 +9,20 @@ abstract_target 'LeadKitAdditions' do pod "PinLayout", '~> 1.6' inhibit_all_warnings! + use_frameworks! target 'LeadKitAdditions iOS' do platform :ios, '9.0' - use_frameworks! - - pod 'LeadKit', '~> 0.7.0' + pod 'LeadKit', :path => '~/Projects/LeadKit/' + # pod 'LeadKit', '~> 0.8.0' end target 'LeadKitAdditions iOS Extensions' do platform :ios, '9.0' - use_frameworks! - - pod "LeadKit/Core-iOS-Extension", '~> 0.7.0' + pod 'LeadKit/Core-iOS-Extension', :path => '~/Projects/LeadKit/' + # pod "LeadKit/Core-iOS-Extension", '~> 0.8.0' end end diff --git a/Podfile.lock b/Podfile.lock index f816c6a..f211683 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,64 +1,81 @@ PODS: - - Alamofire (4.7.2) + - Alamofire (4.7.3) - CryptoSwift (0.9.0) - KeychainAccess (3.1.0) - - LeadKit (0.7.12): - - LeadKit/Core (= 0.7.12) - - LeadKit/Core (0.7.12): - - ObjectMapper (~> 3.1) - - RxAlamofire (~> 4.1) - - RxCocoa (~> 4.1) - - RxSwift (~> 4.1) - - SwiftDate (~> 4.5) - - TableKit (~> 2.6) - - UIScrollView-InfiniteScroll (~> 1.0.0) - - LeadKit/Core-iOS-Extension (0.7.12): - - ObjectMapper (~> 3.1) - - RxAlamofire (~> 4.1) - - RxCocoa (~> 4.1) - - RxSwift (~> 4.1) - - SwiftDate (~> 4.5) - - ObjectMapper (3.1.0) - - PinLayout (1.6.0) - - RxAlamofire (4.2.0): - - RxAlamofire/Core (= 4.2.0) - - RxAlamofire/Core (4.2.0): + - LeadKit (0.8.13): + - LeadKit/Core (= 0.8.13) + - LeadKit/Core (0.8.13): + - RxAlamofire (~> 4.3) + - RxCocoa (~> 4.3) + - RxSwift (~> 4.3) + - SwiftDate (~> 5.0) + - TableKit (~> 2.8) + - UIScrollView-InfiniteScroll (~> 1.1.0) + - LeadKit/Core-iOS-Extension (0.8.13): + - RxAlamofire (~> 4.3) + - RxCocoa (~> 4.3) + - RxSwift (~> 4.3) + - SwiftDate (~> 5.0) + - TableKit (~> 2.8) + - PinLayout (1.8.6) + - RxAlamofire (4.3.0): + - RxAlamofire/Core (= 4.3.0) + - RxAlamofire/Core (4.3.0): - Alamofire (~> 4.5) - RxSwift (~> 4) - - RxCocoa (4.1.2): + - RxCocoa (4.3.1): - RxSwift (~> 4.0) - - RxSwift (4.1.2) - - SwiftDate (4.5.1) - - SwiftLint (0.25.1) + - RxSwift (4.3.1) + - SwiftDate (5.0.9) + - SwiftLint (0.27.0) - SwiftValidator (5.0.0) - - TableKit (2.6.0) - - UIScrollView-InfiniteScroll (1.0.2) + - TableKit (2.8.0) + - UIScrollView-InfiniteScroll (1.1.0) DEPENDENCIES: - CryptoSwift (~> 0.9.0) - KeychainAccess (= 3.1.0) - - LeadKit (~> 0.7.0) - - LeadKit/Core-iOS-Extension (~> 0.7.0) + - LeadKit (from `~/Projects/LeadKit/`) + - LeadKit/Core-iOS-Extension (from `~/Projects/LeadKit/`) - PinLayout (~> 1.6) - SwiftLint (~> 0.25) - SwiftValidator (= 5.0.0) +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - Alamofire + - CryptoSwift + - KeychainAccess + - PinLayout + - RxAlamofire + - RxCocoa + - RxSwift + - SwiftDate + - SwiftLint + - TableKit + - UIScrollView-InfiniteScroll + https://github.com/TouchInstinct/Podspecs: + - SwiftValidator + +EXTERNAL SOURCES: + LeadKit: + :path: "~/Projects/LeadKit/" + SPEC CHECKSUMS: - Alamofire: e4fa87002c137ba2d8d634d2c51fabcda0d5c223 + Alamofire: c7287b6e5d7da964a70935e5db17046b7fde6568 CryptoSwift: bca8c5b653dcc2d9734409242a070ff53bafac86 KeychainAccess: 94c5540b32eabf7bc32bfb976a268e8ea05fd6da - LeadKit: e6628cfa16f5bab6fc001d4fcba9608f60fb6fd3 - ObjectMapper: 20505058f54e5c3ca69e1d6de9897d152a5369a6 - PinLayout: a2bbe9057d49a1e326b13dc4fe8c14751f8c8844 - RxAlamofire: 87a9c588541210cc3e4a1f843ccc3ecf3eb98b31 - RxCocoa: d88ba0f1f6abf040011a9eb4b539324fc426843a - RxSwift: e49536837d9901277638493ea537394d4b55f570 - SwiftDate: 7b56d42a221f582047287deb256b23fc5ed49a60 - SwiftLint: ce933681be10c3266e82576dad676fa815a602e9 + LeadKit: 524c6c2776588534b4fa1d31150c4faf1e997ece + PinLayout: fe2a2432d6982588e208572005c941aeeae417ab + RxAlamofire: 09624d0f2d48ed8b686e4eb4cf68e28cbd2df556 + RxCocoa: 78763c7b07d02455598d9fc3c1ad091a28b73635 + RxSwift: fe0fd770a43acdb7d0a53da411c9b892e69bb6e4 + SwiftDate: 52b718d32ec006861a2be2756cbfa482d438e781 + SwiftLint: 3207c1faa2240bf8973b191820a116113cd11073 SwiftValidator: 46cdd2061962df3ee8bab3c536dea9b34191d459 - TableKit: 61880e4c13ac0ba396a308fcb1ae48f6dec8b458 - UIScrollView-InfiniteScroll: c132d6d5851daff229ab4a1060ccf70a05a051c9 + TableKit: d635663343d00e209f258e35d4ee0072ad1beb1a + UIScrollView-InfiniteScroll: 3ef456bcbe759c19f510a383cff96e6647c98c98 -PODFILE CHECKSUM: 18dadbe1461045569b8c35d705ed56bcac3325c6 +PODFILE CHECKSUM: ab7e7ff4a88de4246e3e2e0b0ffc1959cbd3b7d8 -COCOAPODS: 1.4.0 +COCOAPODS: 1.5.3 diff --git a/Sources/Classes/Cells/PinLayoutTableViewCell.swift b/Sources/Classes/Cells/PinLayoutTableViewCell.swift index 0b9ce7a..a43c20b 100644 --- a/Sources/Classes/Cells/PinLayoutTableViewCell.swift +++ b/Sources/Classes/Cells/PinLayoutTableViewCell.swift @@ -26,7 +26,7 @@ import PinLayout /// Cell that uses PinLayout. Contains methods that should be overriden in subclasses. open class PinLayoutTableViewCell: UITableViewCell, PinLayoutCell { - public override init(style: UITableViewCellStyle, reuseIdentifier: String?) { + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) initializeCell() diff --git a/Sources/Classes/Cells/SeparatorTableViewCell.swift b/Sources/Classes/Cells/SeparatorTableViewCell.swift index 1f3dfe7..8edd9ee 100644 --- a/Sources/Classes/Cells/SeparatorTableViewCell.swift +++ b/Sources/Classes/Cells/SeparatorTableViewCell.swift @@ -45,14 +45,14 @@ open class SeparatorTableViewCell: PinLayoutTableViewCell { /// Move separator upward in hierarchy public func bringSeparatorsToFront() { - contentView.bringSubview(toFront: topSeparator) - contentView.bringSubview(toFront: bottomSeparator) + contentView.bringSubviewToFront(topSeparator) + contentView.bringSubviewToFront(bottomSeparator) } /// Move separator backward in hierarchy public func sendSeparatorsToBack() { - contentView.sendSubview(toBack: topSeparator) - contentView.sendSubview(toBack: bottomSeparator) + contentView.sendSubviewToBack(topSeparator) + contentView.sendSubviewToBack(bottomSeparator) } // MARK: - PinLayoutTableViewCell diff --git a/Sources/Controllers/PassCode/View/BasePassCodeViewController.swift b/Sources/Controllers/PassCode/View/BasePassCodeViewController.swift index a711480..4fcc766 100644 --- a/Sources/Controllers/PassCode/View/BasePassCodeViewController.swift +++ b/Sources/Controllers/PassCode/View/BasePassCodeViewController.swift @@ -47,7 +47,7 @@ public enum PassCodeControllerState { } /// Base view controller that operates with pass code -open class BasePassCodeViewController: UIViewController, ConfigurableController { +open class BasePassCodeViewController: UIViewController, LegacyConfigurableController { public var viewModel: BasePassCodeViewModel! @@ -100,7 +100,7 @@ open class BasePassCodeViewController: UIViewController, ConfigurableController return } - NotificationCenter.default.rx.notification(.UIApplicationWillResignActive) + NotificationCenter.default.rx.notification(UIApplication.willResignActiveNotification) .subscribe(onNext: { [weak self] _ in self?.resetUI() }) diff --git a/Sources/Extensions/UIBarButtonItem+Extensions.swift b/Sources/Extensions/UIBarButtonItem+Extensions.swift index 79c25e2..c94089a 100644 --- a/Sources/Extensions/UIBarButtonItem+Extensions.swift +++ b/Sources/Extensions/UIBarButtonItem+Extensions.swift @@ -26,7 +26,7 @@ public extension UIBarButtonItem { /// Creates activity indicator view and bar button item (based on activity indicator) static var activityIndicator: (barButton: UIBarButtonItem, activityIndicator: UIActivityIndicatorView) { - let indicatorView = UIActivityIndicatorView(activityIndicatorStyle: .white) + let indicatorView = UIActivityIndicatorView(style: .white) let indicatorBar = UIBarButtonItem(customView: indicatorView) return (indicatorBar, indicatorView) } diff --git a/Sources/Protocols/LegacyConfigurableController.swift b/Sources/Protocols/LegacyConfigurableController.swift new file mode 100644 index 0000000..8a2cf26 --- /dev/null +++ b/Sources/Protocols/LegacyConfigurableController.swift @@ -0,0 +1,53 @@ +// +// Copyright (c) 2018 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import LeadKit + +public protocol LegacyConfigurableController: InitializableView { + + associatedtype ViewModelT + + var viewModel: ViewModelT! { get } + + func configureBarButtons() + + func initialLoadView() + +} + +public extension LegacyConfigurableController where Self: UIViewController { + + func initializeView() { + assertionFailure("Use \(initialLoadView) for UIViewController instead!") + } + + /// Method that should be called in viewDidLoad method of UIViewController. + func initialLoadView() { + addViews() + configureLayout() + configureAppearance() + configureBarButtons() + localize() + bindViews() + } + +} diff --git a/build-scripts b/build-scripts index 622b2d3..ea12763 160000 --- a/build-scripts +++ b/build-scripts @@ -1 +1 @@ -Subproject commit 622b2d34508fe0d4103af643bc0d91c75f7bf026 +Subproject commit ea127636275ceea8abcf3ec9aa62ffe6d13f0b72