From 4e154554e0fa36d0be93d3f5c12617ea4b5b4035 Mon Sep 17 00:00:00 2001 From: matthewyan Date: Fri, 6 Sep 2019 15:44:27 +0800 Subject: [PATCH 1/7] RxActionExample support swift 5 --- Libraries Usage/RxActionExample/Podfile | 6 +-- Libraries Usage/RxActionExample/Podfile.lock | 35 ++++++++++++------ .../RxActionExample.xcodeproj/project.pbxproj | 37 +++++++++---------- .../RxActionExample/AppDelegate.swift | 2 +- .../RxActionExample/ViewController.swift | 12 +++--- 5 files changed, 50 insertions(+), 42 deletions(-) diff --git a/Libraries Usage/RxActionExample/Podfile b/Libraries Usage/RxActionExample/Podfile index 290d9ab..b6d1549 100644 --- a/Libraries Usage/RxActionExample/Podfile +++ b/Libraries Usage/RxActionExample/Podfile @@ -1,9 +1,9 @@ -platform :ios, '8.0' +platform :ios, '10.0' use_frameworks! target 'RxActionExample' do -pod 'Action', '~> 2.0.0' +pod 'Action' end @@ -12,7 +12,7 @@ post_install do |installer| target.build_configurations.each do |config| if config.name == 'Debug' config.build_settings['ENABLE_TESTABILITY'] = 'YES' - config.build_settings['SWIFT_VERSION'] = '3.0' + config.build_settings['SWIFT_VERSION'] = '5.0' end end end diff --git a/Libraries Usage/RxActionExample/Podfile.lock b/Libraries Usage/RxActionExample/Podfile.lock index 232afb7..5f49cc3 100644 --- a/Libraries Usage/RxActionExample/Podfile.lock +++ b/Libraries Usage/RxActionExample/Podfile.lock @@ -1,19 +1,30 @@ PODS: - - Action (2.0.0): - - RxCocoa (~> 3.0) - - RxSwift (~> 3.0) - - RxCocoa (3.0.1): - - RxSwift (~> 3.0) - - RxSwift (3.0.1) + - Action (4.0.0): + - RxCocoa (~> 5.0) + - RxSwift (~> 5.0) + - RxCocoa (5.0.0): + - RxRelay (~> 5) + - RxSwift (~> 5) + - RxRelay (5.0.0): + - RxSwift (~> 5) + - RxSwift (5.0.0) DEPENDENCIES: - - Action (~> 2.0.0) + - Action + +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - Action + - RxCocoa + - RxRelay + - RxSwift SPEC CHECKSUMS: - Action: 0bc7f713038917e2d8b7a0cc71278a79c1db06c1 - RxCocoa: 15a52fc590dcc700cb4a690a633b5c5184ce3a78 - RxSwift: af5680055c4ad04480189c52d28385b1029493a6 + Action: 0d14986aad0f1330aa27ce65d0cdeaacbb63d91c + RxCocoa: fcf32050ac00d801f34a7f71d5e8e7f23026dcd8 + RxRelay: 4f7409406a51a55cd88483f21ed898c234d60f18 + RxSwift: 8b0671caa829a763bbce7271095859121cbd895f -PODFILE CHECKSUM: 4749c0cd4c60677e1d71f8634f2e69d25a34300b +PODFILE CHECKSUM: 0e3401fa6333ee48f01ff146cacd94b013502ad1 -COCOAPODS: 1.1.1 +COCOAPODS: 1.7.5 diff --git a/Libraries Usage/RxActionExample/RxActionExample.xcodeproj/project.pbxproj b/Libraries Usage/RxActionExample/RxActionExample.xcodeproj/project.pbxproj index e916842..39dccb9 100644 --- a/Libraries Usage/RxActionExample/RxActionExample.xcodeproj/project.pbxproj +++ b/Libraries Usage/RxActionExample/RxActionExample.xcodeproj/project.pbxproj @@ -100,7 +100,6 @@ 14F750851C6B300A005EED40 /* Frameworks */, 14F750861C6B300A005EED40 /* Resources */, 238D3BB8B043988CBDB3DC8B /* [CP] Embed Pods Frameworks */, - 73D34DB189BA418F850FA322 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -133,6 +132,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -166,28 +166,22 @@ files = ( ); inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RxActionExample/Pods-RxActionExample-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Action/Action.framework", + "${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework", + "${BUILT_PRODUCTS_DIR}/RxRelay/RxRelay.framework", + "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Action.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxRelay.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxActionExample/Pods-RxActionExample-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 73D34DB189BA418F850FA322 /* [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-RxActionExample/Pods-RxActionExample-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RxActionExample/Pods-RxActionExample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; 9C69966928C41B4841CAEF3F /* [CP] Check Pods Manifest.lock */ = { @@ -196,13 +190,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RxActionExample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../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"; + 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; }; /* End PBXShellScriptBuildPhase section */ @@ -333,7 +330,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.droidsonroids.RxActionExample; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -350,7 +347,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.droidsonroids.RxActionExample; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Libraries Usage/RxActionExample/RxActionExample/AppDelegate.swift b/Libraries Usage/RxActionExample/RxActionExample/AppDelegate.swift index fb49b7b..2e98ac0 100644 --- a/Libraries Usage/RxActionExample/RxActionExample/AppDelegate.swift +++ b/Libraries Usage/RxActionExample/RxActionExample/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/Libraries Usage/RxActionExample/RxActionExample/ViewController.swift b/Libraries Usage/RxActionExample/RxActionExample/ViewController.swift index 4ea1a46..c090329 100644 --- a/Libraries Usage/RxActionExample/RxActionExample/ViewController.swift +++ b/Libraries Usage/RxActionExample/RxActionExample/ViewController.swift @@ -48,7 +48,7 @@ class ViewController: UIViewController { input.rx.text .filter { $0 != nil } .map { $0! } - .map { $0.characters.count > 0 } // map them into array of Observable + .map { $0.count > 0 } // map them into array of Observable } // this allows us to use combineLatest, which fires up whenever any of the observables emits a signal let validUsername = Observable.combineLatest(validUsernameCollection) { filters in @@ -69,13 +69,13 @@ class ViewController: UIViewController { NotificationCenter.default.addObserver( self, selector: #selector(keyboardWillShow(_:)), - name: NSNotification.Name.UIKeyboardWillShow, + name: UIResponder.keyboardWillShowNotification, object: nil) NotificationCenter.default.addObserver( self, selector: #selector(keyboardWillHide(_:)), - name: NSNotification.Name.UIKeyboardWillHide, + name: UIResponder.keyboardWillHideNotification, object: nil) } @@ -83,8 +83,8 @@ class ViewController: UIViewController { NotificationCenter.default.removeObserver(self) } - func keyboardWillShow(_ notification: Notification) { - guard let keyboardFrame = (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue else { return } + @objc func keyboardWillShow(_ notification: Notification) { + guard let keyboardFrame = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue else { return } let margin: CGFloat = 10.0 var responderY: CGFloat! formFields.forEach { field in @@ -101,7 +101,7 @@ class ViewController: UIViewController { } } - func keyboardWillHide(_ notification: Notification) { + @objc func keyboardWillHide(_ notification: Notification) { UIView.animate(withDuration: 0.3, animations: { self.currentTranslation = 0.0 self.stackView.transform = CGAffineTransform(translationX: 0.0, y: 0.0) From 9606419c86ba3d15b4c256357b6f0f2ce279d6b2 Mon Sep 17 00:00:00 2001 From: matthewyan Date: Fri, 6 Sep 2019 20:31:58 +0800 Subject: [PATCH 2/7] RxDataSOurcesExample Support Swift 5.0 --- Libraries Usage/RxDataSourcesExample/Podfile | 8 ++-- .../RxDataSourcesExample/Podfile.lock | 48 ++++++++++++------- .../project.pbxproj | 41 ++++++++-------- .../RxDataSourcesExample/AppDelegate.swift | 2 +- .../RxDataSourcesExample/ViewController.swift | 23 +++++---- 5 files changed, 73 insertions(+), 49 deletions(-) diff --git a/Libraries Usage/RxDataSourcesExample/Podfile b/Libraries Usage/RxDataSourcesExample/Podfile index 913fbf0..cd15bca 100644 --- a/Libraries Usage/RxDataSourcesExample/Podfile +++ b/Libraries Usage/RxDataSourcesExample/Podfile @@ -1,10 +1,10 @@ -platform :ios, '8.0' +platform :ios, '10.0' use_frameworks! target 'RxDataSourcesExample' do -pod "RxDataSources", "~> 1.0.0" -pod "NSObject+Rx", "~> 2.0.0" +pod "RxDataSources" +pod "NSObject+Rx" end @@ -13,7 +13,7 @@ post_install do |installer| target.build_configurations.each do |config| if config.name == 'Debug' config.build_settings['ENABLE_TESTABILITY'] = 'YES' - config.build_settings['SWIFT_VERSION'] = '3.0' + config.build_settings['SWIFT_VERSION'] = '5.0' end end end diff --git a/Libraries Usage/RxDataSourcesExample/Podfile.lock b/Libraries Usage/RxDataSourcesExample/Podfile.lock index 4f74ba1..fdc502c 100644 --- a/Libraries Usage/RxDataSourcesExample/Podfile.lock +++ b/Libraries Usage/RxDataSourcesExample/Podfile.lock @@ -1,23 +1,39 @@ PODS: - - NSObject+Rx (2.0.0): - - RxSwift - - RxCocoa (3.0.1): - - RxSwift (~> 3.0) - - RxDataSources (1.0.0): - - RxCocoa (~> 3.0) - - RxSwift (~> 3.0) - - RxSwift (3.0.1) + - Differentiator (4.0.1) + - "NSObject+Rx (5.0.2)": + - RxSwift (~> 5.0) + - RxCocoa (5.0.0): + - RxRelay (~> 5) + - RxSwift (~> 5) + - RxDataSources (4.0.1): + - Differentiator (~> 4.0) + - RxCocoa (~> 5.0) + - RxSwift (~> 5.0) + - RxRelay (5.0.0): + - RxSwift (~> 5) + - RxSwift (5.0.0) DEPENDENCIES: - - NSObject+Rx (~> 2.0.0) - - RxDataSources (~> 1.0.0) + - "NSObject+Rx" + - RxDataSources + +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - Differentiator + - "NSObject+Rx" + - RxCocoa + - RxDataSources + - RxRelay + - RxSwift SPEC CHECKSUMS: - NSObject+Rx: 2a9cd801d9c847e6d2486cbad8d7701b67834e70 - RxCocoa: 15a52fc590dcc700cb4a690a633b5c5184ce3a78 - RxDataSources: 824693e84d00781d0a5e5cedc1ff95ce9250aacd - RxSwift: af5680055c4ad04480189c52d28385b1029493a6 + Differentiator: 886080237d9f87f322641dedbc5be257061b0602 + "NSObject+Rx": 2eb2cf51fd1c554118449a7fbc36e4cd620b9e94 + RxCocoa: fcf32050ac00d801f34a7f71d5e8e7f23026dcd8 + RxDataSources: efee07fa4de48477eca0a4611e6d11e2da9c1114 + RxRelay: 4f7409406a51a55cd88483f21ed898c234d60f18 + RxSwift: 8b0671caa829a763bbce7271095859121cbd895f -PODFILE CHECKSUM: b3490764254da45dabe95d550e5ded812682583d +PODFILE CHECKSUM: 7bbb0529245399b06242736f5086ad94f618f71c -COCOAPODS: 1.1.1 +COCOAPODS: 1.7.5 diff --git a/Libraries Usage/RxDataSourcesExample/RxDataSourcesExample.xcodeproj/project.pbxproj b/Libraries Usage/RxDataSourcesExample/RxDataSourcesExample.xcodeproj/project.pbxproj index 33d3d1a..376d457 100644 --- a/Libraries Usage/RxDataSourcesExample/RxDataSourcesExample.xcodeproj/project.pbxproj +++ b/Libraries Usage/RxDataSourcesExample/RxDataSourcesExample.xcodeproj/project.pbxproj @@ -103,7 +103,6 @@ 14BB13A11C68DB830038C66A /* Frameworks */, 14BB13A21C68DB830038C66A /* Resources */, C6195519FE7DDA08BB69F038 /* [CP] Embed Pods Frameworks */, - 447E6C04FFAF3EC373C9D4A3 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -135,6 +134,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -162,34 +162,22 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 447E6C04FFAF3EC373C9D4A3 /* [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-RxDataSourcesExample/Pods-RxDataSourcesExample-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; 535126794A54DFAAA155B70F /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RxDataSourcesExample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../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"; + 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; }; C6195519FE7DDA08BB69F038 /* [CP] Embed Pods Frameworks */ = { @@ -198,13 +186,26 @@ files = ( ); inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RxDataSourcesExample/Pods-RxDataSourcesExample-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Differentiator/Differentiator.framework", + "${BUILT_PRODUCTS_DIR}/NSObject+Rx/NSObject_Rx.framework", + "${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework", + "${BUILT_PRODUCTS_DIR}/RxDataSources/RxDataSources.framework", + "${BUILT_PRODUCTS_DIR}/RxRelay/RxRelay.framework", + "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Differentiator.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NSObject_Rx.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxDataSources.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxRelay.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxDataSourcesExample/Pods-RxDataSourcesExample-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RxDataSourcesExample/Pods-RxDataSourcesExample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -336,7 +337,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.droidsonroids.RxDataSourcesExample; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -353,7 +354,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.droidsonroids.RxDataSourcesExample; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Libraries Usage/RxDataSourcesExample/RxDataSourcesExample/AppDelegate.swift b/Libraries Usage/RxDataSourcesExample/RxDataSourcesExample/AppDelegate.swift index f698e07..c9d8375 100644 --- a/Libraries Usage/RxDataSourcesExample/RxDataSourcesExample/AppDelegate.swift +++ b/Libraries Usage/RxDataSourcesExample/RxDataSourcesExample/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/Libraries Usage/RxDataSourcesExample/RxDataSourcesExample/ViewController.swift b/Libraries Usage/RxDataSourcesExample/RxDataSourcesExample/ViewController.swift index 75fab1c..a160f92 100644 --- a/Libraries Usage/RxDataSourcesExample/RxDataSourcesExample/ViewController.swift +++ b/Libraries Usage/RxDataSourcesExample/RxDataSourcesExample/ViewController.swift @@ -23,11 +23,18 @@ class ViewController: UIViewController { @IBOutlet weak var tableView: UITableView! @IBOutlet weak var searchBar: UISearchBar! - - let dataSource = RxTableViewSectionedReloadDataSource() + + let dataSource = RxTableViewSectionedReloadDataSource( + configureCell: { (_, tableView, indexPath, _) in + let cell = tableView.dequeueReusableCell(withIdentifier: "cityPrototypeCell", for: indexPath) + return cell + }) + var shownCitiesSection: DefaultSection! var allCities = [String]() var sections = PublishSubject<[DefaultSection]>() + + let disposeBag = DisposeBag() override func viewDidLoad() { super.viewDidLoad() @@ -43,21 +50,21 @@ class ViewController: UIViewController { cell.textLabel?.text = self.shownCitiesSection.items[indexPath.row].title return cell } - + sections .asObservable() - .bindTo(tableView.rx.items(dataSource: dataSource)) - .addDisposableTo(rx_disposeBag) // Instead of creating the bag again and again, use the extension NSObject_rx + .bind(to: tableView.rx.items(dataSource: dataSource)) + .disposed(by: disposeBag) // Instead of creating the bag again and again, use the extension NSObject_rx searchBar .rx.text .filter { $0 != nil } .map { $0! } - .debounce(0.5, scheduler: MainScheduler.instance) + .debounce(.milliseconds(500), scheduler: MainScheduler.instance) .distinctUntilChanged() .subscribe(onNext: { [unowned self] query in let items: [String] - if query.characters.count > 0 { + if query.count > 0 { items = self.allCities.filter { $0.hasPrefix(query) } } else { items = self.allCities @@ -69,7 +76,7 @@ class ViewController: UIViewController { self.sections.onNext([self.shownCitiesSection]) }) - .addDisposableTo(rx_disposeBag) + .disposed(by: disposeBag) } } From c0ce44a631318c47850f55c1646cbcc24a5cb08a Mon Sep 17 00:00:00 2001 From: matthewyan Date: Mon, 9 Sep 2019 12:29:03 +0800 Subject: [PATCH 3/7] support swift 5.0 --- Libraries Usage/RxAlamofireExample/Podfile | 8 +-- .../RxAlamofireExample/Podfile.lock | 51 ++++++++++++------- .../project.pbxproj | 41 +++++++-------- .../RxAlamofireExample/AppDelegate.swift | 2 +- .../RepositoriesViewController.swift | 20 ++++---- 5 files changed, 68 insertions(+), 54 deletions(-) diff --git a/Libraries Usage/RxAlamofireExample/Podfile b/Libraries Usage/RxAlamofireExample/Podfile index 2b0dafc..fcb90d5 100644 --- a/Libraries Usage/RxAlamofireExample/Podfile +++ b/Libraries Usage/RxAlamofireExample/Podfile @@ -1,10 +1,10 @@ -platform :ios, '9.0' +platform :ios, '10.0' use_frameworks! target 'RxAlamofireExample' do -pod 'RxAlamofire/RxCocoa', '~> 3.0.0' -pod 'ObjectMapper', '~> 2.2.0' +pod 'RxAlamofire/RxCocoa' +pod 'ObjectMapper' end @@ -13,7 +13,7 @@ post_install do |installer| target.build_configurations.each do |config| if config.name == 'Debug' config.build_settings['ENABLE_TESTABILITY'] = 'YES' - config.build_settings['SWIFT_VERSION'] = '3.0' + config.build_settings['SWIFT_VERSION'] = '5.0' end end end diff --git a/Libraries Usage/RxAlamofireExample/Podfile.lock b/Libraries Usage/RxAlamofireExample/Podfile.lock index 29f0d50..e145ef5 100644 --- a/Libraries Usage/RxAlamofireExample/Podfile.lock +++ b/Libraries Usage/RxAlamofireExample/Podfile.lock @@ -1,27 +1,40 @@ PODS: - - Alamofire (4.0.1) - - ObjectMapper (2.2.1) - - RxAlamofire/Core (3.0.0): - - Alamofire (~> 4.0) - - RxSwift (~> 3.0) - - RxAlamofire/RxCocoa (3.0.0): + - Alamofire (4.8.2) + - ObjectMapper (3.5.1) + - RxAlamofire/Core (5.0.0): + - Alamofire (~> 4.8) + - RxSwift (~> 5.0) + - RxAlamofire/RxCocoa (5.0.0): - RxAlamofire/Core - - RxCocoa (~> 3.0) - - RxCocoa (3.0.1): - - RxSwift (~> 3.0) - - RxSwift (3.0.1) + - RxCocoa (~> 5.0) + - RxCocoa (5.0.0): + - RxRelay (~> 5) + - RxSwift (~> 5) + - RxRelay (5.0.0): + - RxSwift (~> 5) + - RxSwift (5.0.0) DEPENDENCIES: - - ObjectMapper (~> 2.2.0) - - RxAlamofire/RxCocoa (~> 3.0.0) + - ObjectMapper + - RxAlamofire/RxCocoa + +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - Alamofire + - ObjectMapper + - RxAlamofire + - RxCocoa + - RxRelay + - RxSwift SPEC CHECKSUMS: - Alamofire: 7682d43245de14874acd142ec137b144aa1dd335 - ObjectMapper: 41e43e1a89f8060ef5ea5d04ba852e269a621d68 - RxAlamofire: 0b1fa48f545fffe7f7a28af2086bcaa3b5946cc9 - RxCocoa: 15a52fc590dcc700cb4a690a633b5c5184ce3a78 - RxSwift: af5680055c4ad04480189c52d28385b1029493a6 + Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3 + ObjectMapper: 70187b8941977c62ccfb423caf6b50be405cabf0 + RxAlamofire: e7875a012aff55345672d0f70a2a9cd6aeb0f211 + RxCocoa: fcf32050ac00d801f34a7f71d5e8e7f23026dcd8 + RxRelay: 4f7409406a51a55cd88483f21ed898c234d60f18 + RxSwift: 8b0671caa829a763bbce7271095859121cbd895f -PODFILE CHECKSUM: fd159d27023d0da367a6158bc273a6c42b5a9205 +PODFILE CHECKSUM: 7cd190d4d1b20dfeae2e30defdfae3cac97eb96b -COCOAPODS: 1.1.1 +COCOAPODS: 1.7.5 diff --git a/Libraries Usage/RxAlamofireExample/RxAlamofireExample.xcodeproj/project.pbxproj b/Libraries Usage/RxAlamofireExample/RxAlamofireExample.xcodeproj/project.pbxproj index 4aedd2d..5dfef73 100644 --- a/Libraries Usage/RxAlamofireExample/RxAlamofireExample.xcodeproj/project.pbxproj +++ b/Libraries Usage/RxAlamofireExample/RxAlamofireExample.xcodeproj/project.pbxproj @@ -106,7 +106,6 @@ 14F750A31C6B61B5005EED40 /* Frameworks */, 14F750A41C6B61B5005EED40 /* Resources */, 86DE51D92810F001D71E9BA4 /* [CP] Embed Pods Frameworks */, - 84817871FF0A709EB325C893 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -138,6 +137,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -165,34 +165,32 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 84817871FF0A709EB325C893 /* [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-RxAlamofireExample/Pods-RxAlamofireExample-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; 86DE51D92810F001D71E9BA4 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RxAlamofireExample/Pods-RxAlamofireExample-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework", + "${BUILT_PRODUCTS_DIR}/ObjectMapper/ObjectMapper.framework", + "${BUILT_PRODUCTS_DIR}/RxAlamofire/RxAlamofire.framework", + "${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework", + "${BUILT_PRODUCTS_DIR}/RxRelay/RxRelay.framework", + "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ObjectMapper.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxAlamofire.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxRelay.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxAlamofireExample/Pods-RxAlamofireExample-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RxAlamofireExample/Pods-RxAlamofireExample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; CBB276E83F1AD26A0EFA03D4 /* [CP] Check Pods Manifest.lock */ = { @@ -201,13 +199,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RxAlamofireExample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../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"; + 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; }; /* End PBXShellScriptBuildPhase section */ @@ -340,7 +341,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.droidsonroids.RxAlamofireExample; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -357,7 +358,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.droidsonroids.RxAlamofireExample; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Libraries Usage/RxAlamofireExample/RxAlamofireExample/AppDelegate.swift b/Libraries Usage/RxAlamofireExample/RxAlamofireExample/AppDelegate.swift index 2ca6704..673c969 100644 --- a/Libraries Usage/RxAlamofireExample/RxAlamofireExample/AppDelegate.swift +++ b/Libraries Usage/RxAlamofireExample/RxAlamofireExample/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/Libraries Usage/RxAlamofireExample/RxAlamofireExample/RepositoriesViewController.swift b/Libraries Usage/RxAlamofireExample/RxAlamofireExample/RepositoriesViewController.swift index 81c7563..0fdc3a0 100644 --- a/Libraries Usage/RxAlamofireExample/RxAlamofireExample/RepositoriesViewController.swift +++ b/Libraries Usage/RxAlamofireExample/RxAlamofireExample/RepositoriesViewController.swift @@ -44,8 +44,8 @@ class RepositoriesViewController: UIViewController { return searchBar.rx.text .filter { $0 != nil } .map { $0! } - .filter { $0.characters.count > 0 } - .debounce(0.5, scheduler: MainScheduler.instance) + .filter { $0.count > 0 } + .debounce(.milliseconds(500), scheduler: MainScheduler.instance) .distinctUntilChanged() } @@ -65,7 +65,7 @@ class RepositoriesViewController: UIViewController { return cell } - .addDisposableTo(disposeBag) + .disposed(by: disposeBag) repositoryNetworkModel .rx_repositories @@ -78,7 +78,7 @@ class RepositoriesViewController: UIViewController { } } }) - .addDisposableTo(disposeBag) + .disposed(by: disposeBag) } func setupUI() { @@ -87,13 +87,13 @@ class RepositoriesViewController: UIViewController { NotificationCenter.default.addObserver( self, selector: #selector(keyboardWillShow(_:)), - name: NSNotification.Name.UIKeyboardWillShow, + name: UIResponder.keyboardWillShowNotification, object: nil) NotificationCenter.default.addObserver( self, selector: #selector(keyboardWillHide(_:)), - name: NSNotification.Name.UIKeyboardWillHide, + name: UIResponder.keyboardWillHideNotification, object: nil) } @@ -101,22 +101,22 @@ class RepositoriesViewController: UIViewController { NotificationCenter.default.removeObserver(self) } - func keyboardWillShow(_ notification: Notification) { - guard let keyboardFrame = (notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue else { return } + @objc func keyboardWillShow(_ notification: Notification) { + guard let keyboardFrame = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue else { return } tableViewBottomConstraint.constant = keyboardFrame.height UIView.animate(withDuration: 0.3, animations: { self.view.updateConstraints() }) } - func keyboardWillHide(_ notification: Notification) { + @objc func keyboardWillHide(_ notification: Notification) { tableViewBottomConstraint.constant = 0.0 UIView.animate(withDuration: 0.3, animations: { self.view.updateConstraints() }) } - func tableTapped(_ recognizer: UITapGestureRecognizer) { + @objc func tableTapped(_ recognizer: UITapGestureRecognizer) { let location = recognizer.location(in: tableView) let path = tableView.indexPathForRow(at: location) if searchBar.isFirstResponder { From 966f77493362bc79aa1d37eae08c78001cefd622 Mon Sep 17 00:00:00 2001 From: matthewyan Date: Mon, 7 Oct 2019 21:56:12 +0800 Subject: [PATCH 4/7] RxMKMapViewExample support swift 5.0 --- Libraries Usage/RxMKMapViewExample/Podfile | 2 +- .../RxMKMapViewExample/Podfile.lock | 33 +++++--- .../project.pbxproj | 83 ++++++++++--------- .../RxMKMapViewExample/AppDelegate.swift | 15 ++-- .../RxMKMapViewExample/ViewController.swift | 33 ++++---- 5 files changed, 90 insertions(+), 76 deletions(-) diff --git a/Libraries Usage/RxMKMapViewExample/Podfile b/Libraries Usage/RxMKMapViewExample/Podfile index 316f75a..b59bf47 100644 --- a/Libraries Usage/RxMKMapViewExample/Podfile +++ b/Libraries Usage/RxMKMapViewExample/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -platform :ios, '8.0' +platform :ios, '10.0' # Uncomment this line if you're using Swift use_frameworks! diff --git a/Libraries Usage/RxMKMapViewExample/Podfile.lock b/Libraries Usage/RxMKMapViewExample/Podfile.lock index 8b78491..0de6048 100644 --- a/Libraries Usage/RxMKMapViewExample/Podfile.lock +++ b/Libraries Usage/RxMKMapViewExample/Podfile.lock @@ -1,17 +1,30 @@ PODS: - - RxCocoa (2.2.0): - - RxSwift (~> 2.2) - - RxMKMapView (2.0.1): - - RxCocoa (~> 2.2) - - RxSwift (~> 2.2) - - RxSwift (2.2.0) + - RxCocoa (5.0.0): + - RxRelay (~> 5) + - RxSwift (~> 5) + - RxMKMapView (5.0.0): + - RxCocoa (~> 5.0) + - RxSwift (~> 5.0) + - RxRelay (5.0.0): + - RxSwift (~> 5) + - RxSwift (5.0.0) DEPENDENCIES: - RxMKMapView +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - RxCocoa + - RxMKMapView + - RxRelay + - RxSwift + SPEC CHECKSUMS: - RxCocoa: 42efb7a7145a8d1d5878e94ce48a580d29e0c796 - RxMKMapView: 5477f2facbb010a5e4a4b1b91d2d39635032058c - RxSwift: b8a749f2204c6c7a5c29b306a9c3bc11d5b87c5b + RxCocoa: fcf32050ac00d801f34a7f71d5e8e7f23026dcd8 + RxMKMapView: 7b19fc545887314851ea67b12193bc8c6004dcb5 + RxRelay: 4f7409406a51a55cd88483f21ed898c234d60f18 + RxSwift: 8b0671caa829a763bbce7271095859121cbd895f + +PODFILE CHECKSUM: 21379c36ac025677c81af5870f9265ba6626e829 -COCOAPODS: 0.39.0 +COCOAPODS: 1.7.5 diff --git a/Libraries Usage/RxMKMapViewExample/RxMKMapViewExample.xcodeproj/project.pbxproj b/Libraries Usage/RxMKMapViewExample/RxMKMapViewExample.xcodeproj/project.pbxproj index e6aa6b0..f1435e1 100644 --- a/Libraries Usage/RxMKMapViewExample/RxMKMapViewExample.xcodeproj/project.pbxproj +++ b/Libraries Usage/RxMKMapViewExample/RxMKMapViewExample.xcodeproj/project.pbxproj @@ -7,15 +7,16 @@ objects = { /* Begin PBXBuildFile section */ + 0E910F3F6AB2E7B2FC81BB68 /* Pods_RxMKMapViewExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C5B2671341049A7C1947542 /* Pods_RxMKMapViewExample.framework */; }; 14B272871C7633D800606624 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14B272861C7633D800606624 /* AppDelegate.swift */; }; 14B272891C7633D800606624 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14B272881C7633D800606624 /* ViewController.swift */; }; 14B2728C1C7633D800606624 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 14B2728A1C7633D800606624 /* Main.storyboard */; }; 14B2728E1C7633D800606624 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 14B2728D1C7633D800606624 /* Assets.xcassets */; }; 14B272911C7633D800606624 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 14B2728F1C7633D800606624 /* LaunchScreen.storyboard */; }; - 584E109CAB810819604FB693 /* Pods_RxMKMapViewExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B514238612B89E117C5B80F2 /* Pods_RxMKMapViewExample.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 0B94C31EF632CDC325F8A403 /* Pods-RxMKMapViewExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxMKMapViewExample.release.xcconfig"; path = "Target Support Files/Pods-RxMKMapViewExample/Pods-RxMKMapViewExample.release.xcconfig"; sourceTree = ""; }; 14B272831C7633D800606624 /* RxMKMapViewExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RxMKMapViewExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 14B272861C7633D800606624 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 14B272881C7633D800606624 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; @@ -23,9 +24,8 @@ 14B2728D1C7633D800606624 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 14B272901C7633D800606624 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 14B272921C7633D800606624 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 4A31778D7E7F0FD1EFBC2695 /* Pods-RxMKMapViewExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxMKMapViewExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-RxMKMapViewExample/Pods-RxMKMapViewExample.release.xcconfig"; sourceTree = ""; }; - B514238612B89E117C5B80F2 /* Pods_RxMKMapViewExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RxMKMapViewExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - DEC3F3B5C857441A2DF9DD70 /* Pods-RxMKMapViewExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxMKMapViewExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RxMKMapViewExample/Pods-RxMKMapViewExample.debug.xcconfig"; sourceTree = ""; }; + 410BD822C34A5969C3FFD7D3 /* Pods-RxMKMapViewExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RxMKMapViewExample.debug.xcconfig"; path = "Target Support Files/Pods-RxMKMapViewExample/Pods-RxMKMapViewExample.debug.xcconfig"; sourceTree = ""; }; + 8C5B2671341049A7C1947542 /* Pods_RxMKMapViewExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RxMKMapViewExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -33,7 +33,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 584E109CAB810819604FB693 /* Pods_RxMKMapViewExample.framework in Frameworks */, + 0E910F3F6AB2E7B2FC81BB68 /* Pods_RxMKMapViewExample.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -45,8 +45,8 @@ children = ( 14B272851C7633D800606624 /* RxMKMapViewExample */, 14B272841C7633D800606624 /* Products */, - 3D6F160BDC1089B9E691C5B7 /* Pods */, - 9D792903B23787E95C8A2B09 /* Frameworks */, + 796E8FB417A10529DE580C12 /* Pods */, + 5EB181174125161D0C111631 /* Frameworks */, ); sourceTree = ""; }; @@ -71,21 +71,21 @@ path = RxMKMapViewExample; sourceTree = ""; }; - 3D6F160BDC1089B9E691C5B7 /* Pods */ = { + 5EB181174125161D0C111631 /* Frameworks */ = { isa = PBXGroup; children = ( - DEC3F3B5C857441A2DF9DD70 /* Pods-RxMKMapViewExample.debug.xcconfig */, - 4A31778D7E7F0FD1EFBC2695 /* Pods-RxMKMapViewExample.release.xcconfig */, + 8C5B2671341049A7C1947542 /* Pods_RxMKMapViewExample.framework */, ); - name = Pods; + name = Frameworks; sourceTree = ""; }; - 9D792903B23787E95C8A2B09 /* Frameworks */ = { + 796E8FB417A10529DE580C12 /* Pods */ = { isa = PBXGroup; children = ( - B514238612B89E117C5B80F2 /* Pods_RxMKMapViewExample.framework */, + 410BD822C34A5969C3FFD7D3 /* Pods-RxMKMapViewExample.debug.xcconfig */, + 0B94C31EF632CDC325F8A403 /* Pods-RxMKMapViewExample.release.xcconfig */, ); - name = Frameworks; + path = Pods; sourceTree = ""; }; /* End PBXGroup section */ @@ -95,12 +95,11 @@ isa = PBXNativeTarget; buildConfigurationList = 14B272951C7633D800606624 /* Build configuration list for PBXNativeTarget "RxMKMapViewExample" */; buildPhases = ( - 8E8EB8F5018286E4B2A7E7FF /* Check Pods Manifest.lock */, + 81650A132C2EE6D6EF600F11 /* [CP] Check Pods Manifest.lock */, 14B2727F1C7633D800606624 /* Sources */, 14B272801C7633D800606624 /* Frameworks */, 14B272811C7633D800606624 /* Resources */, - 96C3BB5699275A7E47A30FCD /* Embed Pods Frameworks */, - 73ED784CAAA9673B80217BB3 /* Copy Pods Resources */, + 3FBE9436F595CE4DFBA170FF /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -131,6 +130,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -158,49 +158,50 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 73ED784CAAA9673B80217BB3 /* Copy Pods Resources */ = { + 3FBE9436F595CE4DFBA170FF /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RxMKMapViewExample/Pods-RxMKMapViewExample-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework", + "${BUILT_PRODUCTS_DIR}/RxMKMapView/RxMKMapView.framework", + "${BUILT_PRODUCTS_DIR}/RxRelay/RxRelay.framework", + "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework", ); - name = "Copy Pods Resources"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxMKMapView.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxRelay.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxMKMapViewExample/Pods-RxMKMapViewExample-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RxMKMapViewExample/Pods-RxMKMapViewExample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 8E8EB8F5018286E4B2A7E7FF /* Check Pods Manifest.lock */ = { + 81650A132C2EE6D6EF600F11 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputPaths = ( - ); - name = "Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - 96C3BB5699275A7E47A30FCD /* Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( + inputFileListPaths = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( ); - name = "Embed Pods Frameworks"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RxMKMapViewExample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxMKMapViewExample/Pods-RxMKMapViewExample-frameworks.sh\"\n"; + 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; }; /* End PBXShellScriptBuildPhase section */ @@ -320,25 +321,29 @@ }; 14B272961C7633D800606624 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DEC3F3B5C857441A2DF9DD70 /* Pods-RxMKMapViewExample.debug.xcconfig */; + baseConfigurationReference = 410BD822C34A5969C3FFD7D3 /* Pods-RxMKMapViewExample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = RxMKMapViewExample/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.droidsonroids.RxMKMapViewExample; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; }; name = Debug; }; 14B272971C7633D800606624 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 4A31778D7E7F0FD1EFBC2695 /* Pods-RxMKMapViewExample.release.xcconfig */; + baseConfigurationReference = 0B94C31EF632CDC325F8A403 /* Pods-RxMKMapViewExample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = RxMKMapViewExample/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.droidsonroids.RxMKMapViewExample; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Libraries Usage/RxMKMapViewExample/RxMKMapViewExample/AppDelegate.swift b/Libraries Usage/RxMKMapViewExample/RxMKMapViewExample/AppDelegate.swift index 405beb2..405e5c0 100644 --- a/Libraries Usage/RxMKMapViewExample/RxMKMapViewExample/AppDelegate.swift +++ b/Libraries Usage/RxMKMapViewExample/RxMKMapViewExample/AppDelegate.swift @@ -13,34 +13,31 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - - func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { // Override point for customization after application launch. return true } - func applicationWillResignActive(application: UIApplication) { + func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } - func applicationDidEnterBackground(application: UIApplication) { + func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - func applicationWillEnterForeground(application: UIApplication) { + func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } - func applicationDidBecomeActive(application: UIApplication) { + func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - func applicationWillTerminate(application: UIApplication) { + func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } - - } diff --git a/Libraries Usage/RxMKMapViewExample/RxMKMapViewExample/ViewController.swift b/Libraries Usage/RxMKMapViewExample/RxMKMapViewExample/ViewController.swift index 493d663..daee6b8 100644 --- a/Libraries Usage/RxMKMapViewExample/RxMKMapViewExample/ViewController.swift +++ b/Libraries Usage/RxMKMapViewExample/RxMKMapViewExample/ViewController.swift @@ -25,30 +25,29 @@ class ViewController: UIViewController { func setupRx() { mapView - .rx_willStartLoadingMap - .subscribeNext { + .rx.willStartLoadingMap + .subscribe(onNext: { print("Will start loading map") - } - .addDisposableTo(disposeBag) + }) + .disposed(by: disposeBag) mapView - .rx_didFinishLoadingMap - .subscribeNext { + .rx.didFinishLoadingMap + .subscribe(onNext: { print("Finished loading map") - } - .addDisposableTo(disposeBag) + }) + .disposed(by: disposeBag) mapView - .rx_willStartRenderingMap - .subscribeNext { + .rx.willStartRenderingMap + .subscribe(onNext: { print("Will start rendering map") - } - .addDisposableTo(disposeBag) + }) + .disposed(by: disposeBag) mapView - .rx_didFinishRenderingMap - .subscribeNext { fullyRendered in + .rx.didFinishRenderingMap + .subscribe(onNext: { fullyRendered in print("Finished rendering map? Is it fully rendered tho? Of course \(fullyRendered)!") - } - .addDisposableTo(disposeBag) + }) + .disposed(by: disposeBag) } - } From c633aafde4c7a29c946d74d67eb07bbdfcfc4124 Mon Sep 17 00:00:00 2001 From: matthewyan Date: Thu, 24 Oct 2019 14:30:51 +0800 Subject: [PATCH 5/7] RxMoyaExample adopt swift 5.0 --- Libraries Usage/RxMoyaExample/Podfile | 8 +- Libraries Usage/RxMoyaExample/Podfile.lock | 79 +++++++++++-------- .../RxMoyaExample.xcodeproj/project.pbxproj | 45 ++++++----- .../RxMoyaExample/AppDelegate.swift | 2 +- .../RxMoyaExample/Base.lproj/Main.storyboard | 34 ++++---- .../RxMoyaExample/GithubEndpoint.swift | 6 +- .../IssueListViewController.swift | 11 ++- .../RxMoyaExample/IssueTrackerModel.swift | 18 +++-- 8 files changed, 115 insertions(+), 88 deletions(-) diff --git a/Libraries Usage/RxMoyaExample/Podfile b/Libraries Usage/RxMoyaExample/Podfile index 180827d..8951f1c 100644 --- a/Libraries Usage/RxMoyaExample/Podfile +++ b/Libraries Usage/RxMoyaExample/Podfile @@ -1,10 +1,10 @@ -platform :ios, '8.0' +platform :ios, '10.0' use_frameworks! target 'RxMoyaExample' do -pod 'RxCocoa', '~> 3.0.0' -pod 'Moya-ModelMapper/RxSwift', '~> 4.1.0' +pod 'RxCocoa' +pod 'Moya-ModelMapper/RxSwift' pod 'RxOptional' end @@ -13,7 +13,7 @@ post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['ENABLE_TESTABILITY'] = 'YES' - config.build_settings['SWIFT_VERSION'] = '3.0' + config.build_settings['SWIFT_VERSION'] = '5.0' end end end diff --git a/Libraries Usage/RxMoyaExample/Podfile.lock b/Libraries Usage/RxMoyaExample/Podfile.lock index 2aad473..c0a68c8 100644 --- a/Libraries Usage/RxMoyaExample/Podfile.lock +++ b/Libraries Usage/RxMoyaExample/Podfile.lock @@ -1,44 +1,57 @@ PODS: - - Alamofire (4.2.0) - - ModelMapper (6.0.0) - - Moya (8.0.0): - - Moya/Core (= 8.0.0) - - Moya-ModelMapper/Core (4.1.0): - - ModelMapper - - Moya (~> 8.0.0) - - Moya-ModelMapper/RxSwift (4.1.0): + - Alamofire (4.9.0) + - ModelMapper (10.0.0): + - ModelMapper/Core (= 10.0.0) + - ModelMapper/Core (10.0.0) + - Moya (13.0.1): + - Moya/Core (= 13.0.1) + - Moya-ModelMapper/Core (9.0.0): + - ModelMapper (~> 10.0) + - Moya (~> 13.0) + - Moya-ModelMapper/RxSwift (9.0.0): - Moya-ModelMapper/Core - - Moya/RxSwift (~> 8.0.0) + - Moya/RxSwift (~> 13.0) - RxSwift - - Moya/Core (8.0.0): - - Alamofire (~> 4.2.0) - - Result (~> 3.1.0) - - Moya/RxSwift (8.0.0): + - Moya/Core (13.0.1): + - Alamofire (~> 4.1) + - Result (~> 4.1) + - Moya/RxSwift (13.0.1): - Moya/Core - - RxSwift (~> 3.1.0) - - Result (3.1.0) - - RxCocoa (3.0.1): - - RxSwift (~> 3.0) - - RxOptional (3.1.3): - - RxCocoa - - RxSwift - - RxSwift (3.1.0) + - RxSwift (~> 4.0) + - Result (4.1.0) + - RxCocoa (4.5.0): + - RxSwift (>= 4.4.2, ~> 4.4) + - RxOptional (3.6.2): + - RxCocoa (~> 4.0) + - RxSwift (~> 4.0) + - RxSwift (4.5.0) DEPENDENCIES: - - Moya-ModelMapper/RxSwift (~> 4.1.0) - - RxCocoa (~> 3.0.0) + - Moya-ModelMapper/RxSwift + - RxCocoa - RxOptional +SPEC REPOS: + trunk: + - Alamofire + - ModelMapper + - Moya + - Moya-ModelMapper + - Result + - RxCocoa + - RxOptional + - RxSwift + SPEC CHECKSUMS: - Alamofire: aa2e09d871c9160ac53c90e83c68064a94e3dfbe - ModelMapper: 3596a82f26c43491f6a8d3a00bcdba6ba0e62a93 - Moya: 850a166ab8241bd1c1cea6dbe012e3a2ad62944a - Moya-ModelMapper: 7084396138e6f9359881db654ee6a4d826a64f14 - Result: 4e3ed5995ed94d0cd6a09be9a431fce3f3624bbf - RxCocoa: 15a52fc590dcc700cb4a690a633b5c5184ce3a78 - RxOptional: b97b59183af80d1e729ac9e51d09a10be668d6a8 - RxSwift: 83ff553e7593fdfdcb2562933a64c0284dffdadc + Alamofire: afc3e7c6db61476cb45cdd23fed06bad03bbc321 + ModelMapper: a8dbf2a2003bf626627b9fe7c9a22b3405a30404 + Moya: f4a4b80ff2f8a4ffc208dfb31cd91636622fee6e + Moya-ModelMapper: 4948625af7fc5eef41ad9fdfe0c3517170b50960 + Result: bd966fac789cc6c1563440b348ab2598cc24d5c7 + RxCocoa: cbf70265dc65a981d4ac982e513c10cf23df24a0 + RxOptional: 80426a0ddbd092573e4c482d8cc13302078c4d5e + RxSwift: f172070dfd1a93d70a9ab97a5a01166206e1c575 -PODFILE CHECKSUM: e4a627ec7f263cc6d6a1c51a2ef71d795e4e2dca +PODFILE CHECKSUM: ea459a92ae885dd90e32e8c8834494aac12e001c -COCOAPODS: 1.2.0.rc.1 +COCOAPODS: 1.8.3 diff --git a/Libraries Usage/RxMoyaExample/RxMoyaExample.xcodeproj/project.pbxproj b/Libraries Usage/RxMoyaExample/RxMoyaExample.xcodeproj/project.pbxproj index 15a2168..7b7ccca 100644 --- a/Libraries Usage/RxMoyaExample/RxMoyaExample.xcodeproj/project.pbxproj +++ b/Libraries Usage/RxMoyaExample/RxMoyaExample.xcodeproj/project.pbxproj @@ -128,7 +128,6 @@ 14F750C31C6B8289005EED40 /* Frameworks */, 14F750C41C6B8289005EED40 /* Resources */, C6D974B34A4EDDBA01DC888A /* [CP] Embed Pods Frameworks */, - 830129B445FC80FFE94CBB8E /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -160,6 +159,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -187,34 +187,36 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 830129B445FC80FFE94CBB8E /* [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-RxMoyaExample/Pods-RxMoyaExample-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; C6D974B34A4EDDBA01DC888A /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RxMoyaExample/Pods-RxMoyaExample-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework", + "${BUILT_PRODUCTS_DIR}/ModelMapper/Mapper.framework", + "${BUILT_PRODUCTS_DIR}/Moya/Moya.framework", + "${BUILT_PRODUCTS_DIR}/Moya-ModelMapper/Moya_ModelMapper.framework", + "${BUILT_PRODUCTS_DIR}/Result/Result.framework", + "${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework", + "${BUILT_PRODUCTS_DIR}/RxOptional/RxOptional.framework", + "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Mapper.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Moya.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Moya_ModelMapper.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Result.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxOptional.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxMoyaExample/Pods-RxMoyaExample-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RxMoyaExample/Pods-RxMoyaExample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; FEDABB4F9B6156FE3D9F9B6F /* [CP] Check Pods Manifest.lock */ = { @@ -223,13 +225,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RxMoyaExample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../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"; + 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; }; /* End PBXShellScriptBuildPhase section */ @@ -363,7 +368,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.droidsonroids.RxMoyaExample; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -379,7 +384,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.droidsonroids.RxMoyaExample; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Libraries Usage/RxMoyaExample/RxMoyaExample/AppDelegate.swift b/Libraries Usage/RxMoyaExample/RxMoyaExample/AppDelegate.swift index d8e2e8e..1d3d656 100644 --- a/Libraries Usage/RxMoyaExample/RxMoyaExample/AppDelegate.swift +++ b/Libraries Usage/RxMoyaExample/RxMoyaExample/AppDelegate.swift @@ -13,7 +13,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/Libraries Usage/RxMoyaExample/RxMoyaExample/Base.lproj/Main.storyboard b/Libraries Usage/RxMoyaExample/RxMoyaExample/Base.lproj/Main.storyboard index a3e7ce7..dd8107e 100644 --- a/Libraries Usage/RxMoyaExample/RxMoyaExample/Base.lproj/Main.storyboard +++ b/Libraries Usage/RxMoyaExample/RxMoyaExample/Base.lproj/Main.storyboard @@ -1,8 +1,10 @@ - - + + + - + + @@ -11,7 +13,7 @@ - + @@ -32,26 +34,28 @@ - + - - - - - - + + + + + + + + - + - + - + diff --git a/Libraries Usage/RxMoyaExample/RxMoyaExample/GithubEndpoint.swift b/Libraries Usage/RxMoyaExample/RxMoyaExample/GithubEndpoint.swift index 353254f..7001418 100644 --- a/Libraries Usage/RxMoyaExample/RxMoyaExample/GithubEndpoint.swift +++ b/Libraries Usage/RxMoyaExample/RxMoyaExample/GithubEndpoint.swift @@ -23,6 +23,10 @@ enum GitHub { } extension GitHub: TargetType { + var headers: [String : String]? { + return ["": ""] + } + var baseURL: URL { return URL(string: "https://api.github.com")! } var path: String { switch self { @@ -55,7 +59,7 @@ extension GitHub: TargetType { } } var task: Task { - return .request + return .requestPlain } var parameterEncoding: ParameterEncoding { return JSONEncoding.default diff --git a/Libraries Usage/RxMoyaExample/RxMoyaExample/IssueListViewController.swift b/Libraries Usage/RxMoyaExample/RxMoyaExample/IssueListViewController.swift index 916446a..de3bf27 100644 --- a/Libraries Usage/RxMoyaExample/RxMoyaExample/IssueListViewController.swift +++ b/Libraries Usage/RxMoyaExample/RxMoyaExample/IssueListViewController.swift @@ -37,7 +37,7 @@ class IssueListViewController: UIViewController { @IBOutlet weak var searchBar: UISearchBar! let disposeBag = DisposeBag() - var provider: RxMoyaProvider! + var provider: MoyaProvider! var issueTrackerModel: IssueTrackerModel! var latestRepositoryName: Observable { @@ -54,7 +54,7 @@ class IssueListViewController: UIViewController { func setupRx() { // First part of the puzzle, create our Provider - provider = RxMoyaProvider() + provider = MoyaProvider() // Now we will setup our model issueTrackerModel = IssueTrackerModel(provider: provider, repositoryName: latestRepositoryName) @@ -64,13 +64,12 @@ class IssueListViewController: UIViewController { // we have filled up about 3 table view data source methods issueTrackerModel .trackIssues() - .bindTo(tableView.rx.items) { (tableView, row, item) in + .bind(to: tableView.rx.items) { (tableView, row, item) in let cell = tableView.dequeueReusableCell(withIdentifier: "issueCell", for: IndexPath(row: row, section: 0)) cell.textLabel?.text = item.title return cell - } - .addDisposableTo(disposeBag) + }.disposed(by: disposeBag) // Here we tell table view that if user clicks on a cell, // and the keyboard is still visible, hide it @@ -81,7 +80,7 @@ class IssueListViewController: UIViewController { self.view.endEditing(true) } }) - .addDisposableTo(disposeBag) + .disposed(by: disposeBag) } func url(_ route: TargetType) -> String { diff --git a/Libraries Usage/RxMoyaExample/RxMoyaExample/IssueTrackerModel.swift b/Libraries Usage/RxMoyaExample/RxMoyaExample/IssueTrackerModel.swift index 4dfbda6..bb8e0c9 100644 --- a/Libraries Usage/RxMoyaExample/RxMoyaExample/IssueTrackerModel.swift +++ b/Libraries Usage/RxMoyaExample/RxMoyaExample/IssueTrackerModel.swift @@ -15,7 +15,7 @@ import RxSwift struct IssueTrackerModel { - let provider: RxMoyaProvider + let provider: MoyaProvider let repositoryName: Observable func trackIssues() -> Observable<[Issue]> { @@ -27,7 +27,9 @@ struct IssueTrackerModel { .findRepository(name) } .flatMapLatest { repository -> Observable<[Issue]?> in - guard let repository = repository else { return Observable.just(nil) } + guard let repository = repository else { + return Observable.just(nil) + } print("Repository: \(repository.fullName)") return self.findIssues(repository) @@ -36,16 +38,16 @@ struct IssueTrackerModel { } internal func findIssues(_ repository: Repository) -> Observable<[Issue]?> { - return self.provider + return self.provider.rx .request(GitHub.issues(repositoryFullName: repository.fullName)) - .debug() - .mapArrayOptional(type: Issue.self) + .debug().asObservable() + .mapOptional(to: [Issue].self) } internal func findRepository(_ name: String) -> Observable { - return self.provider + return self.provider.rx .request(GitHub.repo(fullName: name)) - .debug() - .mapObjectOptional(type: Repository.self) + .debug().asObservable() + .mapOptional(to: Repository.self) } } From a2bc1be5ca131efd972340442bc2f62a9457861c Mon Sep 17 00:00:00 2001 From: matthewyan Date: Thu, 24 Oct 2019 15:41:30 +0800 Subject: [PATCH 6/7] RxSwiftExample adopt swift 5.0 --- Libraries Usage/RxSwiftExample/Podfile | 8 ++-- Libraries Usage/RxSwiftExample/Podfile.lock | 28 +++++++++----- .../RxSwiftExample.xcodeproj/project.pbxproj | 37 +++++++++---------- .../RxSwiftExample/ViewController.swift | 5 ++- 4 files changed, 43 insertions(+), 35 deletions(-) diff --git a/Libraries Usage/RxSwiftExample/Podfile b/Libraries Usage/RxSwiftExample/Podfile index 66829bb..c105c07 100644 --- a/Libraries Usage/RxSwiftExample/Podfile +++ b/Libraries Usage/RxSwiftExample/Podfile @@ -4,8 +4,8 @@ use_frameworks! post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| - config.build_settings['SWIFT_VERSION'] = '3.0' - config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.10' + config.build_settings['SWIFT_VERSION'] = '5.0' + config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.13' end end end @@ -14,8 +14,8 @@ end target 'RxSwiftExample' do use_frameworks! -pod 'RxSwift', '~> 3.0.0' -pod 'RxCocoa', '~> 3.0.0' +pod 'RxSwift' +pod 'RxCocoa' end diff --git a/Libraries Usage/RxSwiftExample/Podfile.lock b/Libraries Usage/RxSwiftExample/Podfile.lock index a7d21db..754acd7 100644 --- a/Libraries Usage/RxSwiftExample/Podfile.lock +++ b/Libraries Usage/RxSwiftExample/Podfile.lock @@ -1,16 +1,26 @@ PODS: - - RxCocoa (3.0.1): - - RxSwift (~> 3.0) - - RxSwift (3.0.1) + - RxCocoa (5.0.0): + - RxRelay (~> 5) + - RxSwift (~> 5) + - RxRelay (5.0.0): + - RxSwift (~> 5) + - RxSwift (5.0.0) DEPENDENCIES: - - RxCocoa (~> 3.0.0) - - RxSwift (~> 3.0.0) + - RxCocoa + - RxSwift + +SPEC REPOS: + trunk: + - RxCocoa + - RxRelay + - RxSwift SPEC CHECKSUMS: - RxCocoa: 15a52fc590dcc700cb4a690a633b5c5184ce3a78 - RxSwift: af5680055c4ad04480189c52d28385b1029493a6 + RxCocoa: fcf32050ac00d801f34a7f71d5e8e7f23026dcd8 + RxRelay: 4f7409406a51a55cd88483f21ed898c234d60f18 + RxSwift: 8b0671caa829a763bbce7271095859121cbd895f -PODFILE CHECKSUM: 0c9965e2c560e8fd22b517a0c651124429983a7f +PODFILE CHECKSUM: 90b27b26067bc9d9758bffc2b20d22ae2e88a1c0 -COCOAPODS: 1.1.1 +COCOAPODS: 1.8.3 diff --git a/Libraries Usage/RxSwiftExample/RxSwiftExample.xcodeproj/project.pbxproj b/Libraries Usage/RxSwiftExample/RxSwiftExample.xcodeproj/project.pbxproj index 3c60471..e6e3b4d 100644 --- a/Libraries Usage/RxSwiftExample/RxSwiftExample.xcodeproj/project.pbxproj +++ b/Libraries Usage/RxSwiftExample/RxSwiftExample.xcodeproj/project.pbxproj @@ -100,7 +100,6 @@ 145302821C68CA6700523766 /* Frameworks */, 145302831C68CA6700523766 /* Resources */, 8BEBF9DBFF145F6F2DD8F575 /* [CP] Embed Pods Frameworks */, - E0717E45D05493281766DA2A /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -132,6 +131,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -165,13 +165,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RxSwiftExample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../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"; + 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; }; 8BEBF9DBFF145F6F2DD8F575 /* [CP] Embed Pods Frameworks */ = { @@ -180,28 +183,20 @@ files = ( ); inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RxSwiftExample/Pods-RxSwiftExample-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework", + "${BUILT_PRODUCTS_DIR}/RxRelay/RxRelay.framework", + "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.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", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxSwiftExample/Pods-RxSwiftExample-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - E0717E45D05493281766DA2A /* [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-RxSwiftExample/Pods-RxSwiftExample-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RxSwiftExample/Pods-RxSwiftExample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -331,10 +326,11 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = RxSwiftExample/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.droidsonroids.RxSwiftExample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -345,10 +341,11 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = RxSwiftExample/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.droidsonroids.RxSwiftExample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Libraries Usage/RxSwiftExample/RxSwiftExample/ViewController.swift b/Libraries Usage/RxSwiftExample/RxSwiftExample/ViewController.swift index dee38ba..841d3f5 100644 --- a/Libraries Usage/RxSwiftExample/RxSwiftExample/ViewController.swift +++ b/Libraries Usage/RxSwiftExample/RxSwiftExample/ViewController.swift @@ -48,14 +48,14 @@ class ViewController: UIViewController { searchBar .rx.text // Observable property thanks to RxCocoa .orEmpty // Make it non-optional - .debounce(0.5, scheduler: MainScheduler.instance) // Wait 0.5 for changes. + .debounce(.milliseconds(500), scheduler: MainScheduler.instance) // Wait 0.5 for changes. .distinctUntilChanged() // If they didn't occur, check if the new value is the same as old. .filter { !$0.isEmpty } // If the new value is really new, filter for non-empty query. .subscribe(onNext: { [unowned self] query in // Here we subscribe to every new value, that is not empty (thanks to filter above). self.shownCities = self.allCities.filter { $0.hasPrefix(query) } // We now do our "API Request" to find cities. self.tableView.reloadData() // And reload table view data. }) - .addDisposableTo(disposeBag) // Don't forget to add this to disposeBag. We want to dispose it on deinit. + .disposed(by: disposeBag) // Don't forget to add this to disposeBag. We want to dispose it on deinit. } } @@ -71,6 +71,7 @@ extension ViewController: UITableViewDataSource { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "cityPrototypeCell", for: indexPath) cell.textLabel?.text = shownCities[indexPath.row] + cell.textLabel?.textColor = #colorLiteral(red: 0.9372549057, green: 0.3490196168, blue: 0.1921568662, alpha: 1) return cell } From facd09e3d2851cb4a68320fac0987c2567eafcb1 Mon Sep 17 00:00:00 2001 From: matthewyan Date: Thu, 24 Oct 2019 15:48:42 +0800 Subject: [PATCH 7/7] RxWebkitExample adopt swift 5.0 --- Libraries Usage/RxWebKitExample/Podfile | 6 +-- Libraries Usage/RxWebKitExample/Podfile.lock | 35 +++++++++++------ .../RxWebKitExample.xcodeproj/project.pbxproj | 39 +++++++++---------- .../RxWebKitExample/AppDelegate.swift | 2 +- .../RxWebKitExample/ViewController.swift | 14 +++---- 5 files changed, 53 insertions(+), 43 deletions(-) diff --git a/Libraries Usage/RxWebKitExample/Podfile b/Libraries Usage/RxWebKitExample/Podfile index 66dd93c..61f7d8b 100644 --- a/Libraries Usage/RxWebKitExample/Podfile +++ b/Libraries Usage/RxWebKitExample/Podfile @@ -1,9 +1,9 @@ -platform :ios, '8.0' +platform :ios, '10.0' use_frameworks! target 'RxWebKitExample' do -pod 'RxWebKit', "~> 0.3.3" +pod 'RxWebKit' end @@ -12,7 +12,7 @@ post_install do |installer| target.build_configurations.each do |config| if config.name == 'Debug' config.build_settings['ENABLE_TESTABILITY'] = 'YES' - config.build_settings['SWIFT_VERSION'] = '3.0' + config.build_settings['SWIFT_VERSION'] = '5.0' end end end diff --git a/Libraries Usage/RxWebKitExample/Podfile.lock b/Libraries Usage/RxWebKitExample/Podfile.lock index 944e6ae..2059bc8 100644 --- a/Libraries Usage/RxWebKitExample/Podfile.lock +++ b/Libraries Usage/RxWebKitExample/Podfile.lock @@ -1,19 +1,30 @@ PODS: - - RxCocoa (3.0.1): - - RxSwift (~> 3.0) - - RxSwift (3.0.1) - - RxWebKit (0.3.3): - - RxCocoa (~> 3.0.0) - - RxSwift (~> 3.0.0) + - RxCocoa (5.0.0): + - RxRelay (~> 5) + - RxSwift (~> 5) + - RxRelay (5.0.0): + - RxSwift (~> 5) + - RxSwift (5.0.0) + - RxWebKit (1.0.0): + - RxCocoa (~> 5.0) + - RxSwift (~> 5.0) DEPENDENCIES: - - RxWebKit (~> 0.3.3) + - RxWebKit + +SPEC REPOS: + trunk: + - RxCocoa + - RxRelay + - RxSwift + - RxWebKit SPEC CHECKSUMS: - RxCocoa: 15a52fc590dcc700cb4a690a633b5c5184ce3a78 - RxSwift: af5680055c4ad04480189c52d28385b1029493a6 - RxWebKit: d237746fede36ebe8b94e724cabab5b00d8174e3 + RxCocoa: fcf32050ac00d801f34a7f71d5e8e7f23026dcd8 + RxRelay: 4f7409406a51a55cd88483f21ed898c234d60f18 + RxSwift: 8b0671caa829a763bbce7271095859121cbd895f + RxWebKit: 9ff7ea0780a093450defc7ff13e218678ebe6e4a -PODFILE CHECKSUM: d5d493c800aa512e21978083c503143b71566444 +PODFILE CHECKSUM: 491429c3ee0d3c96193486071cd449348c798beb -COCOAPODS: 1.1.1 +COCOAPODS: 1.8.3 diff --git a/Libraries Usage/RxWebKitExample/RxWebKitExample.xcodeproj/project.pbxproj b/Libraries Usage/RxWebKitExample/RxWebKitExample.xcodeproj/project.pbxproj index a8bd934..316eb81 100644 --- a/Libraries Usage/RxWebKitExample/RxWebKitExample.xcodeproj/project.pbxproj +++ b/Libraries Usage/RxWebKitExample/RxWebKitExample.xcodeproj/project.pbxproj @@ -100,7 +100,6 @@ 1484F5311C72AA3D0086E6EE /* Frameworks */, 1484F5321C72AA3D0086E6EE /* Resources */, 711E7B02A7599FF371296295 /* [CP] Embed Pods Frameworks */, - 9C66C9B5171DD7100A9899FB /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -132,6 +131,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -165,13 +165,22 @@ files = ( ); inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RxWebKitExample/Pods-RxWebKitExample-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework", + "${BUILT_PRODUCTS_DIR}/RxRelay/RxRelay.framework", + "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework", + "${BUILT_PRODUCTS_DIR}/RxWebKit/RxWebKit.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}/RxWebKit.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RxWebKitExample/Pods-RxWebKitExample-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RxWebKitExample/Pods-RxWebKitExample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; 7624B040C1487B8B24467420 /* [CP] Check Pods Manifest.lock */ = { @@ -180,28 +189,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RxWebKitExample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../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"; - showEnvVarsInLog = 0; - }; - 9C66C9B5171DD7100A9899FB /* [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-RxWebKitExample/Pods-RxWebKitExample-resources.sh\"\n"; + 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; }; /* End PBXShellScriptBuildPhase section */ @@ -325,10 +322,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = RxWebKitExample/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.droidsonroids.RxWebKitExample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -338,10 +336,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = RxWebKitExample/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.droidsonroids.RxWebKitExample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/Libraries Usage/RxWebKitExample/RxWebKitExample/AppDelegate.swift b/Libraries Usage/RxWebKitExample/RxWebKitExample/AppDelegate.swift index 1723ef1..b54dc09 100644 --- a/Libraries Usage/RxWebKitExample/RxWebKitExample/AppDelegate.swift +++ b/Libraries Usage/RxWebKitExample/RxWebKitExample/AppDelegate.swift @@ -13,7 +13,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/Libraries Usage/RxWebKitExample/RxWebKitExample/ViewController.swift b/Libraries Usage/RxWebKitExample/RxWebKitExample/ViewController.swift index 7a1acab..199200c 100644 --- a/Libraries Usage/RxWebKitExample/RxWebKitExample/ViewController.swift +++ b/Libraries Usage/RxWebKitExample/RxWebKitExample/ViewController.swift @@ -46,42 +46,42 @@ class ViewController: UIViewController { webView.rx.title .filter { $0 != nil } .map { $0! } - .filter { $0.characters.count > 0 } + .filter { $0.count > 0 } .subscribe(onNext: { title in self.title = title }) - .addDisposableTo(disposeBag) + .disposed(by: disposeBag) searchBar.rx.text .filter { $0 != nil } .map { $0! } - .debounce(0.5, scheduler: MainScheduler.instance) + .debounce(.milliseconds(500), scheduler: MainScheduler.instance) .distinctUntilChanged() .filter { URL(string: $0) != nil } .map { URL(string: $0)! } .subscribe(onNext: { url in self.webView.load(URLRequest(url: url)) }) - .addDisposableTo(disposeBag) + .disposed(by: disposeBag) webView.rx.url .subscribe(onNext: { url in self.searchBar.text = url?.absoluteString print("URL: \(url)") }) - .addDisposableTo(disposeBag) + .disposed(by: disposeBag) webView.rx.estimatedProgress .subscribe(onNext: { print("estimatedProgress: \($0)") }) - .addDisposableTo(disposeBag) + .disposed(by: disposeBag) webView.rx.loading .subscribe(onNext: { loading in UIApplication.shared.isNetworkActivityIndicatorVisible = loading print("loading: \(loading)") }) - .addDisposableTo(disposeBag) + .disposed(by: disposeBag) } }