From 143ca017a1dda7bf1d35c6ebe42dbd5535aebeac Mon Sep 17 00:00:00 2001 From: Felix Mau Date: Sat, 9 Jun 2018 10:25:16 +0200 Subject: [PATCH] * converted to swift 4.2 --- .../project.pbxproj | 16 ++++------ Example/GradientLoadingBar/AppDelegate.swift | 2 +- Example/Pods/Pods.xcodeproj/project.pbxproj | 29 +++++++++---------- .../GradientLoadingBarViewModelTest.swift | 2 +- .../GradientLoadingBarViewModel.swift | 2 +- .../Classes/Views/GradientView.swift | 2 +- 6 files changed, 24 insertions(+), 29 deletions(-) diff --git a/Example/GradientLoadingBar.xcodeproj/project.pbxproj b/Example/GradientLoadingBar.xcodeproj/project.pbxproj index 8503c04..3f608f6 100644 --- a/Example/GradientLoadingBar.xcodeproj/project.pbxproj +++ b/Example/GradientLoadingBar.xcodeproj/project.pbxproj @@ -279,11 +279,11 @@ TargetAttributes = { 607FACCF1AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; - LastSwiftMigration = 0910; + LastSwiftMigration = 1000; }; 607FACE41AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; - LastSwiftMigration = 0910; + LastSwiftMigration = 1000; TestTargetID = 607FACCF1AFB9204008FA782; }; }; @@ -650,8 +650,7 @@ MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -665,8 +664,7 @@ MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -683,8 +681,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GradientLoadingBar_Example.app/GradientLoadingBar_Example"; }; name = Debug; @@ -698,8 +695,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GradientLoadingBar_Example.app/GradientLoadingBar_Example"; }; name = Release; diff --git a/Example/GradientLoadingBar/AppDelegate.swift b/Example/GradientLoadingBar/AppDelegate.swift index 166822c..6f2497e 100644 --- a/Example/GradientLoadingBar/AppDelegate.swift +++ b/Example/GradientLoadingBar/AppDelegate.swift @@ -13,7 +13,7 @@ import UIKit 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. // Customize shared instance of `GradientLoadingBar` diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index 4585313..594e09f 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -38,7 +38,7 @@ 00A137836E31F0B85F44FE7ED28C8A1E /* GradientLoadingBar-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "GradientLoadingBar-umbrella.h"; sourceTree = ""; }; 01F47C5FCDF2DFC31D884CB9472938D3 /* NotificationCenter+ObserveOnce.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = "NotificationCenter+ObserveOnce.swift"; sourceTree = ""; }; 06A09E03ECBCBDC050671661FC8AE063 /* GradientLoadingBarController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = GradientLoadingBarController.swift; path = GradientLoadingBar/Classes/GradientLoadingBarController.swift; sourceTree = ""; }; - 0F3D57DC040DA67C87298D736812CC57 /* GradientLoadingBar.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = GradientLoadingBar.modulemap; sourceTree = ""; }; + 0F3D57DC040DA67C87298D736812CC57 /* GradientLoadingBar.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = GradientLoadingBar.modulemap; sourceTree = ""; }; 14091D853C2B706DF1AE856AE9CFCB78 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 17F4D7C8C9BBFFB7EF138F17A231CC6C /* Pods-GradientLoadingBar_Example-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-GradientLoadingBar_Example-resources.sh"; sourceTree = ""; }; 1878BB23EEDD3A204AC30460410579BB /* GradientLoadingBar-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "GradientLoadingBar-prefix.pch"; sourceTree = ""; }; @@ -50,25 +50,25 @@ 34E3BE59D6126F5B792C30F96DB73D61 /* Pods-GradientLoadingBar_Example-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-GradientLoadingBar_Example-acknowledgements.plist"; sourceTree = ""; }; 35F45E13E0437FDF717140CA22C9C52A /* Pods-GradientLoadingBar_Tests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-GradientLoadingBar_Tests-umbrella.h"; sourceTree = ""; }; 4C3D18A136BBE022D715E4F77216A1F0 /* Pods-GradientLoadingBar_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-GradientLoadingBar_Example.debug.xcconfig"; sourceTree = ""; }; - 4C6F162952B5A3ED1A168FAE5C81155D /* Pods-GradientLoadingBar_Tests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = "Pods-GradientLoadingBar_Tests.modulemap"; sourceTree = ""; }; + 4C6F162952B5A3ED1A168FAE5C81155D /* Pods-GradientLoadingBar_Tests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-GradientLoadingBar_Tests.modulemap"; sourceTree = ""; }; 501B9AB1C1F1E59F4628E81A7970CD37 /* Pods-GradientLoadingBar_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-GradientLoadingBar_Example.release.xcconfig"; sourceTree = ""; }; 50C7A707D05A1C993F972D63ED341DF2 /* Pods-GradientLoadingBar_Example-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-GradientLoadingBar_Example-umbrella.h"; sourceTree = ""; }; 53267FC01B3E758EC7BC06C1D2220B74 /* Pods-GradientLoadingBar_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-GradientLoadingBar_Tests.release.xcconfig"; sourceTree = ""; }; 59139AD54A0546CEF68F95C77C8D6708 /* Pods-GradientLoadingBar_Tests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-GradientLoadingBar_Tests-frameworks.sh"; sourceTree = ""; }; 5F2D68AB1D719F1B064D511C976B1ABE /* Pods-GradientLoadingBar_Tests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-GradientLoadingBar_Tests-acknowledgements.markdown"; sourceTree = ""; }; 63D66746F49F8782E7357FA82EF7779D /* UIColor+Initializers.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = "UIColor+Initializers.swift"; sourceTree = ""; }; - 6518FD84E10BB5DA39E8C1DB4FB82203 /* Pods-GradientLoadingBar_Example.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = "Pods-GradientLoadingBar_Example.modulemap"; sourceTree = ""; }; + 6518FD84E10BB5DA39E8C1DB4FB82203 /* Pods-GradientLoadingBar_Example.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-GradientLoadingBar_Example.modulemap"; sourceTree = ""; }; 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; - 66A7D431F7F1C404F022C930C937FAF4 /* Pods_GradientLoadingBar_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_GradientLoadingBar_Example.framework; path = "Pods-GradientLoadingBar_Example.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; - 73CB53E9177A6953693286C0325D1881 /* GradientLoadingBar.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = GradientLoadingBar.framework; path = GradientLoadingBar.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 66A7D431F7F1C404F022C930C937FAF4 /* Pods_GradientLoadingBar_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GradientLoadingBar_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 73CB53E9177A6953693286C0325D1881 /* GradientLoadingBar.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GradientLoadingBar.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 754B7114D4EEDF2BB932C2E3D924F774 /* GradientLoadingBarViewModel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = GradientLoadingBarViewModel.swift; sourceTree = ""; }; 77280710966B3ABC4F68126D78BA144E /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 91C3A7E062B6B3E795C008251C9BD8BA /* Pods-GradientLoadingBar_Example-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-GradientLoadingBar_Example-dummy.m"; sourceTree = ""; }; - 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; AE41E5BEBBA1125468690FAAE3B7E176 /* Pods-GradientLoadingBar_Example-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-GradientLoadingBar_Example-acknowledgements.markdown"; sourceTree = ""; }; AE81FE3F50CEA8E993C3DC8F5A9989B8 /* Pods-GradientLoadingBar_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-GradientLoadingBar_Tests.debug.xcconfig"; sourceTree = ""; }; B4E51896180DEC5DBCEC4A155254A5B7 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - B9BB15F0F0026C6CDBF8F539B4167BD7 /* Pods_GradientLoadingBar_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_GradientLoadingBar_Tests.framework; path = "Pods-GradientLoadingBar_Tests.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + B9BB15F0F0026C6CDBF8F539B4167BD7 /* Pods_GradientLoadingBar_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GradientLoadingBar_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C47EFA242B2BA62A2408CC13176C080D /* GradientLoadingBar-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "GradientLoadingBar-dummy.m"; sourceTree = ""; }; CCC1BC5CEB1151E0A04A33B26AE57411 /* GradientLoadingBar.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = GradientLoadingBar.xcconfig; sourceTree = ""; }; E81AB562A2ACC55D8595C5C93F545EA7 /* Pods-GradientLoadingBar_Tests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-GradientLoadingBar_Tests-dummy.m"; sourceTree = ""; }; @@ -125,7 +125,6 @@ isa = PBXGroup; children = ( ); - name = SwiftLint; path = SwiftLint; sourceTree = ""; }; @@ -176,7 +175,6 @@ 65C0353BB71BCBC3188B47D592FC85DB /* NotificationCenter */, 8C3E21AB5A63578048F47461925AA43E /* UIColor */, ); - name = Extensions; path = Extensions; sourceTree = ""; }; @@ -185,7 +183,6 @@ children = ( 01F47C5FCDF2DFC31D884CB9472938D3 /* NotificationCenter+ObserveOnce.swift */, ); - name = NotificationCenter; path = NotificationCenter; sourceTree = ""; }; @@ -224,7 +221,6 @@ children = ( 63D66746F49F8782E7357FA82EF7779D /* UIColor+Initializers.swift */, ); - name = UIColor; path = UIColor; sourceTree = ""; }; @@ -258,7 +254,6 @@ isa = PBXGroup; children = ( ); - name = SwiftFormat; path = SwiftFormat; sourceTree = ""; }; @@ -293,7 +288,6 @@ children = ( 246B489FC979CB11F78FF76AE8B59FE2 /* Durations.swift */, ); - name = Structs; path = Structs; sourceTree = ""; }; @@ -400,6 +394,11 @@ attributes = { LastSwiftUpdateCheck = 0830; LastUpgradeCheck = 0700; + TargetAttributes = { + F07543EF32FF53CF85E6DF5DD1513CBB = { + LastSwiftMigration = 1000; + }; + }; }; buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; compatibilityVersion = "Xcode 3.2"; @@ -487,7 +486,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -550,7 +549,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; diff --git a/Example/Tests/ViewModel/GradientLoadingBarViewModelTest.swift b/Example/Tests/ViewModel/GradientLoadingBarViewModelTest.swift index a3e3cf6..d63c9da 100644 --- a/Example/Tests/ViewModel/GradientLoadingBarViewModelTest.swift +++ b/Example/Tests/ViewModel/GradientLoadingBarViewModelTest.swift @@ -60,7 +60,7 @@ class GradientLoadingBarViewModelTest: XCTestCase { let keyWindow = UIWindow() sharedApplicationMock.keyWindow = keyWindow - notificationCenter.post(name: .UIWindowDidBecomeKey, + notificationCenter.post(name: UIWindow.didBecomeKeyNotification, object: nil) XCTAssertEqual(delegateMock.keyWindow, keyWindow) diff --git a/GradientLoadingBar/Classes/ViewModel/GradientLoadingBarViewModel.swift b/GradientLoadingBar/Classes/ViewModel/GradientLoadingBarViewModel.swift index 7874715..609d36c 100644 --- a/GradientLoadingBar/Classes/ViewModel/GradientLoadingBarViewModel.swift +++ b/GradientLoadingBar/Classes/ViewModel/GradientLoadingBarViewModel.swift @@ -69,7 +69,7 @@ class GradientLoadingBarViewModel { guard let keyWindow = sharedApplication.keyWindow else { // If the controller initializer is called in `appDelegate` key window will not be available, // so we setup an observer to inform the delegate when it's ready. - keyWindowIsAvailableObserver = notificationCenter.observeOnce(forName: .UIWindowDidBecomeKey) { _ in + keyWindowIsAvailableObserver = notificationCenter.observeOnce(forName: UIWindow.didBecomeKeyNotification) { _ in self.setupObserverForKeyWindow() } diff --git a/GradientLoadingBar/Classes/Views/GradientView.swift b/GradientLoadingBar/Classes/Views/GradientView.swift index 7e56b95..f9ace41 100644 --- a/GradientLoadingBar/Classes/Views/GradientView.swift +++ b/GradientLoadingBar/Classes/Views/GradientView.swift @@ -93,7 +93,7 @@ public final class GradientView: UIView { animation.duration = duration - animation.fillMode = kCAFillModeForwards + animation.fillMode = .forwards animation.isRemovedOnCompletion = false gradientLayer.add(animation, forKey: animationKey)