Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ReactiveX/RxSwift" ~> 5.1.1
github "ReactiveX/RxSwift" ~> 6.0.0
3 changes: 3 additions & 0 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
github "Quick/Nimble" "v9.0.0"
github "Quick/Quick" "v3.0.0"
github "ReactiveX/RxSwift" "6.0.0"
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let package = Package(
.library(name: "RxCoreLocation", targets: ["RxCoreLocation"])
],
dependencies: [
.package(url: "https://github.com/ReactiveX/RxSwift.git", from: "5.1.1")
.package(url: "https://github.com/ReactiveX/RxSwift.git", from: "6.0.0")
],
targets: [
.target(name: "RxCoreLocation", dependencies: ["RxSwift", "RxCocoa"], path: "Sources")
Expand Down
6 changes: 3 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

pod 'RxCoreLocation', '~> 1.4'
pod 'RxCoreLocation', '~> 1.5.1'
```

Then, run the following command:
Expand All @@ -62,7 +62,7 @@ $ brew install carthage
To integrate RxCoreLocation into your Xcode project using Carthage, specify it in your `Cartfile`:

```ogdl
github "RxSwiftCommunity/RxCoreLocation" ~> 1.4
github "RxSwiftCommunity/RxCoreLocation" ~> 1.5.1
```
### Swift Package Manager

Expand All @@ -74,7 +74,7 @@ import PackageDescription
let package = Package(
name: "HelloRxCoreLocation",
dependencies: [
.Package(url: "https://github.com/RxSwiftCommunity/RxCoreLocation.git", "1.4")
.Package(url: "https://github.com/RxSwiftCommunity/RxCoreLocation.git", "1.5.1")
]
)
```
Expand Down
6 changes: 3 additions & 3 deletions RxCoreLocation.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'RxCoreLocation'
s.version = '1.5.0'
s.version = '1.5.1'
s.license = { :type => "MIT", :file => "LICENSE" }
s.summary = 'RxCoreLocation abstract the Rx behavior for Core Location'
s.homepage = 'http://github.com/RxSwiftCommunity/RxCoreLocation'
Expand All @@ -17,8 +17,8 @@ Pod::Spec.new do |s|
s.subspec "Core" do |ss|
ss.source_files = "Sources/*.swift"
ss.framework = "Foundation"
ss.dependency "RxSwift", "~> 5.1"
ss.dependency "RxCocoa", "~> 5.1"
ss.dependency "RxSwift", "~> 6.0"
ss.dependency "RxCocoa", "~> 6.0"
end

end
188 changes: 119 additions & 69 deletions RxCoreLocation.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
20 changes: 7 additions & 13 deletions RxCoreLocationExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
C41E94981FC4388400815E71 /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C41E94951FC4380F00815E71 /* RxSwift.framework */; };
C41E94991FC4388400815E71 /* RxSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C41E94951FC4380F00815E71 /* RxSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
C41E949A1FC4388A00815E71 /* RxCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C41E94941FC4380F00815E71 /* RxCocoa.framework */; };
C41E949B1FC4388A00815E71 /* RxCocoa.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C41E94941FC4380F00815E71 /* RxCocoa.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
C47207A01FB8ED5400197310 /* berlin.gpx in Resources */ = {isa = PBXBuildFile; fileRef = C472079F1FB8ED5400197310 /* berlin.gpx */; };
C4A8A3EA1FB5B4F600356A42 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4A8A3E91FB5B4F600356A42 /* AppDelegate.swift */; };
C4A8A3EC1FB5B4F600356A42 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4A8A3EB1FB5B4F600356A42 /* ViewController.swift */; };
Expand All @@ -29,8 +25,6 @@
dstSubfolderSpec = 10;
files = (
C4BADF221FC4D8B800847618 /* RxCoreLocation.framework in Embed Frameworks */,
C41E949B1FC4388A00815E71 /* RxCocoa.framework in Embed Frameworks */,
C41E94991FC4388400815E71 /* RxSwift.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -60,8 +54,6 @@
buildActionMask = 2147483647;
files = (
C4BADF211FC4D8B800847618 /* RxCoreLocation.framework in Frameworks */,
C41E949A1FC4388A00815E71 /* RxCocoa.framework in Frameworks */,
C41E94981FC4388400815E71 /* RxSwift.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -140,7 +132,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0910;
LastUpgradeCheck = 0940;
LastUpgradeCheck = 1240;
ORGANIZATIONNAME = "Bob Godwin";
TargetAttributes = {
C4A8A3E51FB5B4F600356A42 = {
Expand Down Expand Up @@ -238,6 +230,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -264,7 +257,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(PROJECT_DIR)/Carthage/Build/iOS";
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -300,6 +293,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -320,7 +314,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(PROJECT_DIR)/Carthage/Build/iOS";
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
Expand All @@ -342,7 +336,7 @@
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
INFOPLIST_FILE = RxCoreLocationExample/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = bobgodwinx.RxCoreLocationExample;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -363,7 +357,7 @@
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
INFOPLIST_FILE = RxCoreLocationExample/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = bobgodwinx.RxCoreLocationExample;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1240"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
18 changes: 18 additions & 0 deletions RxCoreLocationExample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@ class ViewController: UIViewController {
.subscribe(onNext: { _ in })
.disposed(by: bag)

if #available(iOS 14, *) {
manager.rx
.authorizationStatus
.debug("authorizationStatus")
.subscribe(onNext: { value in
print("authorizationStatus \(value)")
})
.disposed(by: bag)

manager.rx
.accuracyAuthorization
.debug("accuracyAuthorization")
.subscribe(onNext: { value in
print("accuracyAuthorization \(value)")
})
.disposed(by: bag)
}

/// Subscribe to placemark
manager.rx
.placemark
Expand Down
21 changes: 21 additions & 0 deletions Sources/CLLocationManagerDelegateEvents+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,34 @@ extension Reactive where Base: CLLocationManager {
}

/// Reactive wrapper for `func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus)`
@available(iOS, introduced: 4.2, deprecated: 14.0, message: "Use didUpdateAuthorization from iOS 14")
public var didChangeAuthorization: ControlEvent<CLAuthorizationEvent> {
let source: Observable<CLAuthorizationEvent> = delegate
.methodInvoked(.didChangeAuthorization)
.map(clAuthorizationStatus)
return ControlEvent(events: source)
}

@available(iOS 14.0, OSX 14.0, watchOSApplicationExtension 7.0, tvOS 14.0, *)
public var didLocationManagerDidChangeAuthorization: ControlEvent<CLLocationManagerDidChangeAuthorizationEvent> {
let source: Observable<CLLocationManagerDidChangeAuthorizationEvent> = delegate
.methodInvoked(.didLocationManagerDidChangeAuthorization)
.map(clChangeAuthorizationStatus)

return ControlEvent(events: source)
}

@available(iOS 14.0, OSX 14.0, watchOSApplicationExtension 7.0, tvOS 14.0, *)
public var accuracyAuthorization: Observable<CLAccuracyAuthorization> {
return self.didLocationManagerDidChangeAuthorization
.map({$0.accuracyAuthorization})
}

@available(iOS 14.0, OSX 14.0, watchOSApplicationExtension 7.0, tvOS 14.0, *)
public var authorizationStatus: Observable<CLAuthorizationStatus> {
return self.didLocationManagerDidChangeAuthorization
.map({$0.authorizationStatus})
}
/// Reactive wrapper for `func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])`
public var didUpdateLocations: ControlEvent<CLLocationsEvent> {
let source: Observable<CLLocationsEvent> = delegate
Expand Down
5 changes: 5 additions & 0 deletions Sources/Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ func clAuthorizationStatus(_ args: [Any]) throws -> CLAuthorizationEvent {
return (manager, status)
}

func clChangeAuthorizationStatus(_ args: [Any]) throws -> CLLocationManagerDidChangeAuthorizationEvent {
let manager = try castOrThrow(CLLocationManager.self, args[0])
return (manager)
}

func clLocationsEvent(_ args: [Any]) throws -> CLLocationsEvent {
let manager = try castOrThrow(CLLocationManager.self, args[0])
let locations = try castOrThrow(Array<CLLocation>.self, args[1])
Expand Down
6 changes: 6 additions & 0 deletions Sources/RxEventTypealias.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

import CoreLocation.CLLocationManagerDelegate

/// locationManagerDidChangeAuthorization
///
/// Discussion:
/// Invoked when the authorization status changes for this application.
public typealias CLLocationManagerDidChangeAuthorizationEvent = (CLLocationManager)

/// locationManager:didChangeAuthorizationStatus:
///
/// Discussion:
Expand Down
2 changes: 2 additions & 0 deletions Sources/RxSelectors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import CoreLocation.CLLocationManagerDelegate

extension Selector {
@available(iOS 14.0, OSX 14.0, watchOSApplicationExtension 7.0, tvOS 14.0, *)
static let didLocationManagerDidChangeAuthorization = #selector(CLLocationManagerDelegate.locationManagerDidChangeAuthorization(_:))
static let didChangeAuthorization = #selector(CLLocationManagerDelegate.locationManager(_:didChangeAuthorization:))
static let didUpdateLocations = #selector(CLLocationManagerDelegate.locationManager(_:didUpdateLocations:))
static let didFailWithError = #selector(CLLocationManagerDelegate.locationManager(_:didFailWithError:))
Expand Down
17 changes: 17 additions & 0 deletions carthage-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

# carthage.sh
# Usage example: ./carthage-build.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.
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8' >> $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 "$@"
28 changes: 0 additions & 28 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,55 +32,27 @@ jobs:
-workspace RxCoreLocation.xcworkspace
-scheme 'RxCoreLocation-iOS' -sdk iphonesimulator
-destination "name=iPhone 11" | xcpretty -c --test
- run:
name: Run Tests (Swift 5.1)
command: >
set -o pipefail && xcodebuild test SWIFT_VERSION=5.1
-workspace RxCoreLocation.xcworkspace
-scheme 'RxCoreLocation-iOS' -sdk iphonesimulator
-destination "name=iPhone 11" | xcpretty -c --test
- run:
name: Build watchOS (Swift 5.2)
command: >
set -o pipefail && xcodebuild build SWIFT_VERSION=5.2
-workspace RxCoreLocation.xcworkspace
-scheme RxCoreLocation-watchOS -sdk watchsimulator
-destination "name=Apple Watch Series 5 - 44mm" | xcpretty -c
- run:
name: Build watchOS (Swift 5.1)
command: >
set -o pipefail && xcodebuild build SWIFT_VERSION=5.1
-workspace RxCoreLocation.xcworkspace
-scheme RxCoreLocation-watchOS -sdk watchsimulator
-destination "name=Apple Watch Series 5 - 44mm" | xcpretty -c
- run:
name: Build macOS (Swift 5.2)
command: >
set -o pipefail && xcodebuild build SWIFT_VERSION=5.2
-workspace RxCoreLocation.xcworkspace
-scheme RxCoreLocation-macOS -sdk macosx
-destination "arch=x86_64" | xcpretty -c
- run:
name: Build macOS (Swift 5.1)
command: >
set -o pipefail && xcodebuild build SWIFT_VERSION=5.1
-workspace RxCoreLocation.xcworkspace
-scheme RxCoreLocation-macOS -sdk macosx
-destination "arch=x86_64" | xcpretty -c
- run:
name: Build tvOS (Swift 5.2)
command: >
set -o pipefail && xcodebuild build SWIFT_VERSION=5.2
-workspace RxCoreLocation.xcworkspace
-scheme RxCoreLocation-tvOS -sdk appletvsimulator
-destination "name=Apple TV 4K (at 1080p)" | xcpretty -c
- run:
name: Build tvOS (Swift 5.1)
command: >
set -o pipefail && xcodebuild build SWIFT_VERSION=5.1
-workspace RxCoreLocation.xcworkspace
-scheme RxCoreLocation-tvOS -sdk appletvsimulator
-destination "name=Apple TV 4K (at 1080p)" | xcpretty -c
- store_artifacts:
path: /tmp/xcode-test-results
workflows:
Expand Down
2 changes: 2 additions & 0 deletions tmp.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8
EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))