Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Swift 4.0 for Carthage #22

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
+ support query pedometer data
khanhpoeta committed Aug 22, 2019
commit e3c434e46870e9a830578e6f34c6d17431097a51
18 changes: 18 additions & 0 deletions Pod/Classes/RxCoreMotion.swift
Original file line number Diff line number Diff line change
@@ -153,6 +153,7 @@ extension Reactive where Base: CMMotionManager {
}

extension Reactive where Base: CMPedometer {

public func pedometer(from: Date! = Date()) -> Observable<CMPedometerData> {
return memoize(key: &pedometerKey) {
Observable.create { observer in
@@ -174,6 +175,23 @@ extension Reactive where Base: CMPedometer {
}
}

public func query(from fromDate:Date, to toDate:Date)->Single<CMPedometerData>{
return Single.create { observer in
let pedometer = self.base
pedometer.queryPedometerData(from: fromDate, to: toDate, withHandler: { (data, error) in
if let _ = error
{
observer(.error(error!))
return
}
guard let data = data else {
return
}
observer(.success(data))
})
return Disposables.create {}
}
}

public var pedometer: Observable<CMPedometerData> {
return memoize(key: &pedometerKey) {
14 changes: 7 additions & 7 deletions RxCoreMotion.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@
06A38EF2230EA977004CF703 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS5.3.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; };
06A38EF9230EABAB004CF703 /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxSwift.framework; path = Carthage/Build/iOS/RxSwift.framework; sourceTree = "<group>"; };
06A38EFB230EABC9004CF703 /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxSwift.framework; path = Carthage/Build/watchOS/RxSwift.framework; sourceTree = "<group>"; };
06A38F19230EB60D004CF703 /* RxCoreMotion_watchOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxCoreMotion_watchOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
06A38F19230EB60D004CF703 /* RxCoreMotion.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxCoreMotion.framework; sourceTree = BUILT_PRODUCTS_DIR; };
06A38F1B230EB60D004CF703 /* RxCoreMotion_watch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RxCoreMotion_watch.h; sourceTree = "<group>"; };
06A38F1C230EB60D004CF703 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
06A38F24230EB65D004CF703 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS5.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
@@ -87,7 +87,7 @@
isa = PBXGroup;
children = (
667B12F51E7BCACB001151C7 /* RxCoreMotion.framework */,
06A38F19230EB60D004CF703 /* RxCoreMotion_watchOS.framework */,
06A38F19230EB60D004CF703 /* RxCoreMotion.framework */,
);
name = Products;
sourceTree = "<group>";
@@ -160,7 +160,7 @@
);
name = "RxCoreMotion-watchOS";
productName = "RxCoreMotion-watch";
productReference = 06A38F19230EB60D004CF703 /* RxCoreMotion_watchOS.framework */;
productReference = 06A38F19230EB60D004CF703 /* RxCoreMotion.framework */;
productType = "com.apple.product-type.framework";
};
667B12F41E7BCACB001151C7 /* RxCoreMotion */ = {
@@ -298,7 +298,7 @@
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.poeta.RxCoreMotion-watchOS.RxCoreMotion-watch";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PRODUCT_NAME = RxCoreMotion;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "watchsimulator watchos";
@@ -307,7 +307,7 @@
TARGETED_DEVICE_FAMILY = 4;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
WATCHOS_DEPLOYMENT_TARGET = 5.3;
WATCHOS_DEPLOYMENT_TARGET = 4.0;
};
name = Debug;
};
@@ -346,15 +346,15 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.poeta.RxCoreMotion-watchOS.RxCoreMotion-watch";
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PRODUCT_NAME = RxCoreMotion;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "watchsimulator watchos";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
WATCHOS_DEPLOYMENT_TARGET = 5.3;
WATCHOS_DEPLOYMENT_TARGET = 4.0;
};
name = Release;
};