diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index a6b1d69..368f493 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -100,7 +100,6 @@ 68B695541DFA643F00D3BEA7 /* Frameworks */, 68B695551DFA643F00D3BEA7 /* Resources */, 5A6F3A57A5B4341A0D73BF0E /* [CP] Embed Pods Frameworks */, - 4D3CBFE2048DCCC99B4492A9 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -118,20 +117,20 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0810; - LastUpgradeCheck = 0910; + LastUpgradeCheck = 1120; ORGANIZATIONNAME = ebt; TargetAttributes = { 68B695561DFA643F00D3BEA7 = { CreatedOnToolsVersion = 8.1; DevelopmentTeam = AY957U87NM; - LastSwiftMigration = 0910; + LastSwiftMigration = 1120; ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = 68B695521DFA643F00D3BEA7 /* Build configuration list for PBXProject "Example" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -161,41 +160,28 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 4D3CBFE2048DCCC99B4492A9 /* [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-Example/Pods-Example-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; 5A6F3A57A5B4341A0D73BF0E /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh", + "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks.sh", "${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework", + "${BUILT_PRODUCTS_DIR}/RxRelay/RxRelay.framework", "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework", "${BUILT_PRODUCTS_DIR}/RxUIAlertController/RxUIAlertController.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxRelay.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxUIAlertController.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; AE49EF36DBB328161162ECEE /* [CP] Check Pods Manifest.lock */ = { @@ -254,6 +240,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -263,6 +250,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -270,6 +258,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -310,6 +299,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -319,6 +309,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -326,6 +317,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -367,7 +359,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.morenotepad.Example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -384,7 +376,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.morenotepad.Example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/Example/Example/AppDelegate.swift b/Example/Example/AppDelegate.swift index e91e3a8..a7ab327 100644 --- a/Example/Example/AppDelegate.swift +++ b/Example/Example/AppDelegate.swift @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } diff --git a/Example/Podfile.lock b/Example/Podfile.lock index f8adfd5..7f14fe3 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,23 +1,33 @@ PODS: - - RxCocoa (4.0.0): - - RxSwift (~> 4.0) - - RxSwift (4.0.0) - - RxUIAlertController (1.1.0): + - RxCocoa (5.0.1): + - RxRelay (~> 5) + - RxSwift (~> 5) + - RxRelay (5.0.1): + - RxSwift (~> 5) + - RxSwift (5.0.1) + - RxUIAlertController (1.2): - RxCocoa - RxSwift DEPENDENCIES: - RxUIAlertController (from `../`) +SPEC REPOS: + trunk: + - RxCocoa + - RxRelay + - RxSwift + EXTERNAL SOURCES: RxUIAlertController: - :path: ../ + :path: "../" SPEC CHECKSUMS: - RxCocoa: d62846ca96495d862fa4c59ea7d87e5031d7340e - RxSwift: fd680d75283beb5e2559486f3c0ff852f0d35334 - RxUIAlertController: d8f3c7683902ace299d22f59f0c60e77e8478a62 + RxCocoa: e741b9749968e8a143e2b787f1dfbff2b63d0a5c + RxRelay: 89d54507f4fd4d969e6ec1d4bd7f3673640b4640 + RxSwift: e2dc62b366a3adf6a0be44ba9f405efd4c94e0c4 + RxUIAlertController: 52096a2e7ec1a70658fe87b052db268e5820429c PODFILE CHECKSUM: e001db0045e2931dc0163727851e37d20de11750 -COCOAPODS: 1.3.1 +COCOAPODS: 1.8.4 diff --git a/RxUIAlertController.podspec b/RxUIAlertController.podspec index 0e93f48..c056fe6 100644 --- a/RxUIAlertController.podspec +++ b/RxUIAlertController.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "RxUIAlertController" - s.version = "1.1.1" + s.version = "1.2" s.summary = "ReactiveX way to use UIAlertController on iOS." s.description = <<-EOS RxSwift binding for [Permission](https://github.com/delba/Permission) API that helps you with UIAlertController in iOS. @@ -9,8 +9,8 @@ Pod::Spec.new do |s| s.license = 'MIT' s.author = { "roshanman" => "morenotepad@163.com" } s.source = { :git => "https://github.com/roshanman/RxUIAlertController.git", :tag => s.version.to_s } - s.platform = :ios, '8.0' - s.ios.deployment_target = '8.0' + s.platform = :ios, '10.0' + s.ios.deployment_target = '10.0' s.source_files = 'Source/*.swift' s.dependency 'RxSwift' s.dependency 'RxCocoa' diff --git a/Source/RxAlertController.swift b/Source/RxAlertController.swift index 805a258..a9bcb6a 100644 --- a/Source/RxAlertController.swift +++ b/Source/RxAlertController.swift @@ -10,17 +10,14 @@ import UIKit import RxSwift import RxCocoa -@available(iOS 8.0, *) public func Alert(title: String?, message: String?) -> AlertController { return AlertController(title: title, message: message, preferredStyle: .alert) } -@available(iOS 8.0, *) public func ActionSheet(title: String?, message: String?) -> AlertController { return AlertController(title: title, message: message, preferredStyle: .actionSheet) } -@available(iOS 8.0, *) public class AlertController: NSObject { public struct Result { @@ -40,7 +37,7 @@ public class AlertController: NSObject { private var retainSelf: Any? private let disposeBag = DisposeBag() - init(title: String?, message: String?, preferredStyle: UIAlertControllerStyle) { + init(title: String?, message: String?, preferredStyle: UIAlertController.Style) { alertController = .init(title:title, message:message, preferredStyle:preferredStyle) super.init() @@ -56,12 +53,12 @@ public class AlertController: NSObject { retainSelf = self } - public func addAction(title: String, style: UIAlertActionStyle = .default, + public func addAction(title: String, style: UIAlertAction.Style = .default, configure: ((UIAlertController, UIAlertAction) -> Void)? = nil) -> Self { let action = UIAlertAction(title: title, style: style) { [unowned self] action in let result = Result(alert: self.alertController, buttonTitle: title, - buttonIndex: self.alertController.actions.index(of: action) ?? 0) + buttonIndex: self.alertController.actions.firstIndex(of: action) ?? 0) self.observer?.onNext(result) self.observer?.onCompleted() @@ -73,7 +70,7 @@ public class AlertController: NSObject { } @available(iOS 9.0, *) - public func addPreferredAction(title: String, style: UIAlertActionStyle = .default, + public func addPreferredAction(title: String, style: UIAlertAction.Style = .default, configure: ((UIAlertController, UIAlertAction) -> Void)? = nil) -> Self { return addAction(title: title, style: style) { alertController, action in alertController.preferredAction = action @@ -134,8 +131,8 @@ public class AlertController: NSObject { private var topViewController:UIViewController? { var topController = self.presentedController - while topController?.childViewControllers.last != nil { - topController = topController?.childViewControllers.last! + while topController?.children.last != nil { + topController = topController?.children.last! } return topController @@ -176,7 +173,7 @@ public class AlertController: NSObject { } public extension Reactive where Base: AlertController { - public func show(animated: Bool = true, completion: (() -> Void)? = nil) -> Observable { + func show(animated: Bool = true, completion: (() -> Void)? = nil) -> Observable { self.base.show(animated: animated, completion: completion) return Observable.create { observer in