diff --git a/.gitignore b/.gitignore index 0316453..9b5cd2d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,32 @@ -.DS_Store +# Xcode + sourcekitten-output.json docs/ -/.build -/Packages /*.xcodeproj **/xcuserdata **/xcshareddata -Pods/ -Carthage/ -Examples/**/Podfile.lock *.xcconfig *.framework.zip -.idea/ + +# CocoaPods + +Pods/ +Examples/**/Podfile.lock + +# Carthage + +Carthage/ + +# Various + +.DS_Store + +# Swift Package Manager + +.build/ +Packages/ +.swiftpm + +# AppCode + +.idea/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index dc96e3e..d7dd4b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ -osx_image: xcode10.2 +osx_image: xcode12.3 language: objective-c sudo: required env: @@ -6,12 +6,12 @@ env: - PROJECT="RxKeyboard.xcodeproj" - SCHEME="RxKeyboard-Package" - IOS_SDK="iphonesimulator" - - MACOS_SDK="macosx10.14" - - TVOS_SDK="appletvsimulator12.2" - - WATCHOS_SDK="watchsimulator5.2" + - MACOS_SDK="macosx11.0" + - TVOS_SDK="appletvsimulator9.0" + - WATCHOS_SDK="watchsimulator3.0" - FRAMEWORK="RxKeyboard" matrix: - - SDK="$IOS_SDK" TEST=0 SWIFT_VERSION=5.0 DESTINATION="platform=iOS Simulator,name=iPhone 8" + - SDK="$IOS_SDK" TEST=0 SWIFT_VERSION=5.1 DESTINATION="platform=iOS Simulator,name=iPhone 8" install: - swift --version @@ -49,7 +49,7 @@ before_deploy: - bundle exec swiftproj configure-scheme --project RxKeyboard.xcodeproj --scheme RxKeyboard-Package --buildable-targets RxKeyboard - bundle exec swiftproj remove-framework --project RxKeyboard.xcodeproj --target RxKeyboard --framework RxCocoa.framework - bundle exec swiftproj remove-framework --project RxKeyboard.xcodeproj --target RxKeyboard --framework RxCocoaRuntime.framework - - carthage bootstrap + - ./carthage.sh bootstrap - carthage build --no-skip-current --verbose | xcpretty -c - carthage archive RxKeyboard diff --git a/Cartfile b/Cartfile index 43e186b..b974c62 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1 @@ -github "ReactiveX/RxSwift" ~> 5.0.0 +github "ReactiveX/RxSwift" ~> 6.0.0 diff --git a/Cartfile.resolved b/Cartfile.resolved index b751e3d..c07923a 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1 +1 @@ -github "ReactiveX/RxSwift" "5.0.1" +github "ReactiveX/RxSwift" "6.0.0" diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 62472bb..1f3b880 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,23 +1,23 @@ PODS: - CGFloatLiteral (0.5.0) - ManualLayout (1.3.0) - - ReusableKit (2.1.0): - - ReusableKit/Core (= 2.1.0) - - ReusableKit/Core (2.1.0) - - RxCocoa (5.0.0): - - RxRelay (~> 5) - - RxSwift (~> 5) - - RxKeyboard (1.0.0): - - RxCocoa (~> 5.0) - - RxSwift (~> 5.0) - - RxRelay (5.0.0): - - RxSwift (~> 5) - - RxSwift (5.0.0) - - SnapKit (5.0.0) - - SwiftyColor (1.2.0) - - SwiftyImage (1.5.0) - - Then (2.4.0) - - "UITextView+Placeholder (1.2.1)" + - ReusableKit (3.0.0): + - ReusableKit/Core (= 3.0.0) + - ReusableKit/Core (3.0.0) + - RxCocoa (6.0.0): + - RxRelay (= 6.0.0) + - RxSwift (= 6.0.0) + - RxKeyboard (2.0.0): + - RxCocoa (~> 6.0) + - RxSwift (~> 6.0) + - RxRelay (6.0.0): + - RxSwift (= 6.0.0) + - RxSwift (6.0.0) + - SnapKit (5.0.1) + - SwiftyColor (1.2.1) + - SwiftyImage (1.6.0) + - Then (2.7.0) + - "UITextView+Placeholder (1.4.0)" DEPENDENCIES: - CGFloatLiteral @@ -31,7 +31,7 @@ DEPENDENCIES: - "UITextView+Placeholder" SPEC REPOS: - https://github.com/cocoapods/specs.git: + trunk: - CGFloatLiteral - ManualLayout - ReusableKit @@ -51,17 +51,17 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: CGFloatLiteral: 0328648f666e3cb2263d5ee3972df9d320786d25 ManualLayout: 68ac8cfa6b5f656f7a9fadec3730208b95986880 - ReusableKit: d0b040de03b293288b0ca27a78602691d3346d9b - RxCocoa: fcf32050ac00d801f34a7f71d5e8e7f23026dcd8 - RxKeyboard: 6683c4344304a00f943c158bd8a43ce5469c82a7 - RxRelay: 4f7409406a51a55cd88483f21ed898c234d60f18 - RxSwift: 8b0671caa829a763bbce7271095859121cbd895f - SnapKit: fd22d10eb9aff484d79a8724eab922c1ddf89bcf - SwiftyColor: ac23e6c0b561838c1ef0f554ff170cceba14546b - SwiftyImage: b4f0523c4a775c79c45dd328f42ed9b3111d5898 - Then: 71866660c7af35a7343831f7668e7cd2b62ee0f2 - "UITextView+Placeholder": 0c3efd97f37ea64bde7f34cc6e90fe02e87b3909 + ReusableKit: e5f853ad4652e411f96b6119b2488afa12929be6 + RxCocoa: 3f79328fafa3645b34600f37c31e64c73ae3a80e + RxKeyboard: aefd4787ca8be28a4470cb871141fb50e105f900 + RxRelay: 8d593be109c06ea850df027351beba614b012ffb + RxSwift: c14e798c59b9f6e9a2df8fd235602e85cc044295 + SnapKit: 97b92857e3df3a0c71833cce143274bf6ef8e5eb + SwiftyColor: a2f468071c1b96be1ba41a0be7cf70d645cd7dcc + SwiftyImage: 65c71a147f417fc0fe137d17b135aaa666279a09 + Then: acfe0be7e98221c6204e12f8161459606d5d822d + "UITextView+Placeholder": d7b0c400921f66523f3a85d74f774512e14f6502 PODFILE CHECKSUM: 217b0b1c7b2faddc54272a5bde63843c54f48190 -COCOAPODS: 1.6.1 +COCOAPODS: 1.10.0 diff --git a/Gemfile b/Gemfile index 9775661..e1552a2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,4 @@ source 'https://rubygems.org' -ruby '~> 2.3' -gem 'cocoapods', '~> 1.6' +gem 'cocoapods', '~> 1.10' gem 'swiftproj' diff --git a/Gemfile.lock b/Gemfile.lock index 338a7d7..c26ab86 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,83 +1,97 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.0) - activesupport (4.2.11.1) - i18n (~> 0.7) + CFPropertyList (3.0.3) + activesupport (5.2.4.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + algoliasearch (1.27.5) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) atomos (0.1.3) - claide (1.0.2) - cocoapods (1.6.2) - activesupport (>= 4.0.2, < 5) + claide (1.0.3) + cocoapods (1.10.0) + addressable (~> 2.6) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.6.2) - cocoapods-deintegrate (>= 1.0.2, < 2.0) - cocoapods-downloader (>= 1.2.2, < 2.0) + cocoapods-core (= 1.10.0) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 1.4.0, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) - cocoapods-stats (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.3.1, < 2.0) + cocoapods-trunk (>= 1.4.0, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) - fourflusher (>= 2.2.0, < 3.0) + fourflusher (>= 2.3.0, < 3.0) gh_inspector (~> 1.0) molinillo (~> 0.6.6) nap (~> 1.0) ruby-macho (~> 1.4) - xcodeproj (>= 1.8.1, < 2.0) - cocoapods-core (1.6.2) - activesupport (>= 4.0.2, < 6) + xcodeproj (>= 1.19.0, < 2.0) + cocoapods-core (1.10.0) + activesupport (> 5.0, < 6) + addressable (~> 2.6) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) fuzzy_match (~> 2.0.4) nap (~> 1.0) + netrc (~> 0.11) + public_suffix + typhoeus (~> 1.0) cocoapods-deintegrate (1.0.4) - cocoapods-downloader (1.2.2) + cocoapods-downloader (1.4.0) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) - cocoapods-stats (1.1.0) - cocoapods-trunk (1.3.1) + cocoapods-trunk (1.5.0) nap (>= 0.8, < 2.0) netrc (~> 0.11) - cocoapods-try (1.1.0) + cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.1.5) + concurrent-ruby (1.1.7) escape (0.0.4) - fourflusher (2.2.0) + ethon (0.12.0) + ffi (>= 1.3.0) + ffi (1.14.2) + fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) - i18n (0.9.5) + httpclient (2.8.3) + i18n (1.8.6) concurrent-ruby (~> 1.0) - minitest (5.11.3) + json (2.5.1) + minitest (5.14.2) molinillo (0.6.6) - nanaimo (0.2.6) + nanaimo (0.3.0) nap (1.1.0) netrc (0.11.0) + public_suffix (4.0.6) ruby-macho (1.4.0) swiftproj (0.1.0) colored2 (>= 3.0) xcodeproj (>= 1.5) thread_safe (0.3.6) - tzinfo (1.2.5) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (1.2.9) thread_safe (~> 0.1) - xcodeproj (1.9.0) + xcodeproj (1.19.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.2.6) + nanaimo (~> 0.3.0) PLATFORMS ruby DEPENDENCIES - cocoapods (~> 1.6) + cocoapods (~> 1.10) swiftproj -RUBY VERSION - ruby 2.3.1p112 - BUNDLED WITH - 1.17.3 + 2.2.4 diff --git a/Package.resolved b/Package.resolved index e3afef8..c620799 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/ReactiveX/RxSwift.git", "state": { "branch": null, - "revision": "b3e888b4972d9bc76495dd74d30a8c7fad4b9395", - "version": "5.0.1" + "revision": "c8742ed97fc2f0c015a5ea5eddefb064cd7532d2", + "version": "6.0.0" } } ] diff --git a/Package.swift b/Package.swift index 8ba3d39..7689c46 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.0 +// swift-tools-version:5.1 import PackageDescription @@ -8,7 +8,7 @@ let package = Package( .library(name: "RxKeyboard", targets: ["RxKeyboard"]), ], dependencies: [ - .package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "5.0.0")), + .package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "6.0.0")), ], targets: [ .target(name: "RxKeyboard", dependencies: ["RxSwift", "RxCocoa"]), diff --git a/RxKeyboard.json b/RxKeyboard.json index 63c1d87..06a1ab8 100644 --- a/RxKeyboard.json +++ b/RxKeyboard.json @@ -8,5 +8,6 @@ "0.9.0": "https://github.com/RxSwiftCommunity/RxKeyboard/releases/download/0.9.0/RxKeyboard.framework.zip", "0.9.1": "https://github.com/RxSwiftCommunity/RxKeyboard/releases/download/0.9.1/RxKeyboard.framework.zip", "0.9.2": "https://github.com/RxSwiftCommunity/RxKeyboard/releases/download/0.9.2/RxKeyboard.framework.zip", - "1.0.0": "https://github.com/RxSwiftCommunity/RxKeyboard/releases/download/1.0.0/RxKeyboard.framework.zip" + "1.0.0": "https://github.com/RxSwiftCommunity/RxKeyboard/releases/download/1.0.0/RxKeyboard.framework.zip", + "2.0.0": "https://github.com/RxSwiftCommunity/RxKeyboard/releases/download/2.0.0/RxKeyboard.framework.zip", } diff --git a/RxKeyboard.podspec b/RxKeyboard.podspec index afff4c5..a2d8890 100644 --- a/RxKeyboard.podspec +++ b/RxKeyboard.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'RxKeyboard' - s.version = '1.0.0' + s.version = '2.0.0' s.summary = 'Reactive Keyboard in iOS' s.homepage = 'https://github.com/RxSwiftCommunity/RxKeyboard' s.license = { :type => 'MIT', :file => 'LICENSE' } @@ -8,12 +8,12 @@ Pod::Spec.new do |s| s.source = { :git => 'https://github.com/RxSwiftCommunity/RxKeyboard.git', :tag => s.version.to_s } s.source_files = 'Sources/**/*.swift' - s.frameworks = 'UIKit', 'Foundation' + s.frameworks = 'UIKit' s.requires_arc = true - s.swift_version = "5.0" + s.swift_version = "5.1" - s.dependency 'RxSwift', '~> 5.0' - s.dependency 'RxCocoa', '~> 5.0' + s.dependency 'RxSwift', '~> 6.0' + s.dependency 'RxCocoa', '~> 6.0' - s.ios.deployment_target = '8.0' + s.ios.deployment_target = '9.0' end diff --git a/Sources/RxKeyboard/RxKeyboard.swift b/Sources/RxKeyboard/RxKeyboard.swift index 9563576..b59ce21 100644 --- a/Sources/RxKeyboard/RxKeyboard.swift +++ b/Sources/RxKeyboard/RxKeyboard.swift @@ -50,17 +50,10 @@ public class RxKeyboard: NSObject, RxKeyboardType { // MARK: Initializing override init() { - #if swift(>=4.2) - let keyboardWillChangeFrame = UIResponder.keyboardWillChangeFrameNotification - let keyboardWillHide = UIResponder.keyboardWillHideNotification - let keyboardFrameEndKey = UIResponder.keyboardFrameEndUserInfoKey - let applicationDidFinishLaunching = UIApplication.didFinishLaunchingNotification - #else - let keyboardWillChangeFrame = NSNotification.Name.UIKeyboardWillChangeFrame - let keyboardWillHide = NSNotification.Name.UIKeyboardWillHide - let keyboardFrameEndKey = UIKeyboardFrameEndUserInfoKey - let applicationDidFinishLaunching = NSNotification.Name.UIApplicationDidFinishLaunching - #endif + + let keyboardWillChangeFrame = UIResponder.keyboardWillChangeFrameNotification + let keyboardWillHide = UIResponder.keyboardWillHideNotification + let keyboardFrameEndKey = UIResponder.keyboardFrameEndUserInfoKey let defaultFrame = CGRect( x: 0, @@ -131,9 +124,8 @@ public class RxKeyboard: NSObject, RxKeyboardType { // gesture recognizer self.panRecognizer.delegate = self - NotificationCenter.default.rx.notification(applicationDidFinishLaunching) - .map { _ in Void() } - .startWith(Void()) // when RxKeyboard is initialized before UIApplication.window is created + + UIApplication.rx.didFinishLaunching // when RxKeyboard is initialized before UIApplication.window is created .subscribe(onNext: { _ in UIApplication.shared.windows.first?.addGestureRecognizer(self.panRecognizer) }) @@ -167,7 +159,7 @@ extension RxKeyboard: UIGestureRecognizerDelegate { _ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer ) -> Bool { - return gestureRecognizer === self.panRecognizer + gestureRecognizer === self.panRecognizer } } diff --git a/scripts/carthage.sh b/scripts/carthage.sh new file mode 100755 index 0000000..e21348f --- /dev/null +++ b/scripts/carthage.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# carthage.sh +# Usage example: ./carthage.sh build --platform iOS + +set -euo pipefail + +xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX) +trap 'rm -f "$xcconfig"' INT TERM HUP EXIT + +# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise +# the build will fail on lipo due to duplicate architectures. + +CURRENT_XCODE_VERSION=$(xcodebuild -version | grep "Build version" | cut -d' ' -f3) +echo "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$CURRENT_XCODE_VERSION = arm64 arm64e armv7 armv7s armv6 armv8" >> $xcconfig + +echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$(XCODE_PRODUCT_BUILD_VERSION))' >> $xcconfig +echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig + +export XCODE_XCCONFIG_FILE="$xcconfig" +carthage build "$@" \ No newline at end of file