Skip to content

Commit

Permalink
Merge pull request #119 from polarofficial/xcframework-support-and-Rx…
Browse files Browse the repository at this point in the history
…Swift6

RxSwift 6.0 dependency update and Xcframework support added for Polar SDK
  • Loading branch information
JOikarinen authored Jan 13, 2021
2 parents 5a30ef7 + 283c213 commit 452b49c
Show file tree
Hide file tree
Showing 264 changed files with 4,468 additions and 76,272 deletions.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,16 @@ public void onDestroy() {
`api.autoConnectToDevice(-50, null).subscribe()` to connect nearby device or `api.searchForDevice()` to scan and select the device

# iOS: Getting started
Detailed documentation [Full Documentation](polar-sdk-ios/docs/). Minimum iOS version is 10.
Detailed documentation: [Documentation](polar-sdk-ios/docs/). Minimum iOS version is 12.
## Requirements
* Xcode 12.x
* Swift 5.x
## Dependencies
* [RxSwift 6.0](https://github.com/ReactiveX/RxSwift) or above
## Installation
Compiled Sdk and dependencies can be found from [polar-sdk-ios](polar-sdk-ios/)
Precompiled 5.1.1 RxSwift is added to sdk package. iOS example contains `Cartfile if you desire to compile dependency yourself.

1. In the project properties __General__ tab, add `PolarBleSdk.framework` , `RxSwift.framework` to __Embedded binaries__ and __Linked Frameworks and Libraries__.

2. In project target settings enable __Background Modes__, add __Uses Bluetooth LE accessories__
1. **PolarBLE SDK**: Download the PolarBLE SDK XCFramework from [polar-sdk-ios](polar-sdk-ios/) or from the [releases](https://github.com/polarofficial/polar-ble-sdk/releases). For detailed information how to add XCFramework to XCode project, see the [tutorial](https://developer.apple.com/videos/play/wwdc2019/416/). You may use PolarBLE SDK [sources](sources/iOS/ios-communications/) as well.
2. **RxSwift**: To use PolarBLE SDK you need [RxSwift](https://github.com/ReactiveX/RxSwift) added to your project. Recomended way is to add RxSwift as XCFramework dependency.
3. In project target settings enable __Background Modes__, add __Uses Bluetooth LE accessories__

## Code example: Heart rate
See the [example](examples/example-ios) folder for the full project
Expand All @@ -271,10 +273,10 @@ import RxSwift
```
class MyController: UIViewController,
PolarBleApiObserver,
PolarBleApiPowerStateObserver,
PolarBleApiDeviceFeaturesObserver,
PolarBleApiDeviceHrObserver {
PolarBleApiObserver,
PolarBleApiPowerStateObserver,
PolarBleApiDeviceFeaturesObserver,
PolarBleApiDeviceHrObserver {
// NOTICE only FEATURE_HR is enabled, to enable more features like battery info
// e.g. PolarBleApiDefaultImpl.polarImplementation(DispatchQueue.main, features: Features.hr.rawValue |
// Features.batteryStatus.rawValue)
Expand Down
1 change: 0 additions & 1 deletion examples/example-ios/Cartfile

This file was deleted.

1 change: 0 additions & 1 deletion examples/example-ios/Cartfile.resolved

This file was deleted.

9 changes: 6 additions & 3 deletions examples/example-ios/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Example project demonstrating usage of iOS-communications SDK
# Example project demonstrating usage of PolarBle SDK

# Dependencies
* iOS-communications SDK
* [RxSwift](https://github.com/ReactiveX/RxSwift)
* [PolarBleSdk.xcframework](https://github.com/polarofficial/polar-ble-sdk/releases)
* [RxSwift 6.0](https://github.com/ReactiveX/RxSwift) or above

# Setup the example project

* Example project dependencies are already setup. Only setup your development team to build and test the capabilities of PolarBle SDK
20 changes: 0 additions & 20 deletions examples/example-ios/carthage.sh

This file was deleted.

43 changes: 25 additions & 18 deletions examples/example-ios/polarBleSdkTestApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 48;
objectVersion = 52;
objects = {

/* Begin PBXBuildFile section */
Expand All @@ -13,10 +13,10 @@
6C770A5E205269C800F3D51D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6C770A5C205269C800F3D51D /* Main.storyboard */; };
6C770A60205269C800F3D51D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6C770A5F205269C800F3D51D /* Assets.xcassets */; };
6C770A63205269C800F3D51D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6C770A61205269C800F3D51D /* LaunchScreen.storyboard */; };
A5D322752566A06100E8C9A2 /* PolarBleSdk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A5D322742566A06100E8C9A2 /* PolarBleSdk.framework */; };
A5D322762566A06100E8C9A2 /* PolarBleSdk.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A5D322742566A06100E8C9A2 /* PolarBleSdk.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
A5D3227825678D8100E8C9A2 /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A5D3227725678D8000E8C9A2 /* RxSwift.framework */; };
A5D3227925678D8100E8C9A2 /* RxSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A5D3227725678D8000E8C9A2 /* RxSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
A521CACA25AD7A3A00151D51 /* RxSwift.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A521CAC925AD7A3A00151D51 /* RxSwift.xcframework */; };
A521CACB25AD7A3A00151D51 /* RxSwift.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A521CAC925AD7A3A00151D51 /* RxSwift.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
A521CACD25AD7A4B00151D51 /* PolarBleSdk.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A521CACC25AD7A4B00151D51 /* PolarBleSdk.xcframework */; };
A521CACE25AD7A4B00151D51 /* PolarBleSdk.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A521CACC25AD7A4B00151D51 /* PolarBleSdk.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -26,8 +26,8 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
A5D3227925678D8100E8C9A2 /* RxSwift.framework in Embed Frameworks */,
A5D322762566A06100E8C9A2 /* PolarBleSdk.framework in Embed Frameworks */,
A521CACB25AD7A3A00151D51 /* RxSwift.xcframework in Embed Frameworks */,
A521CACE25AD7A4B00151D51 /* PolarBleSdk.xcframework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -53,17 +53,17 @@
6C770A62205269C800F3D51D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
6C770A64205269C800F3D51D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6C770A9F2057A35A00F3D51D /* polarBleSdkTestApp-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "polarBleSdkTestApp-Bridging-Header.h"; sourceTree = "<group>"; };
A5D322742566A06100E8C9A2 /* PolarBleSdk.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PolarBleSdk.framework; path = "../../polar-sdk-ios/PolarBleSdk.framework"; sourceTree = "<group>"; };
A5D3227725678D8000E8C9A2 /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxSwift.framework; path = Carthage/Build/iOS/RxSwift.framework; sourceTree = "<group>"; };
A521CAC925AD7A3A00151D51 /* RxSwift.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = RxSwift.xcframework; path = polarBleSdkTestApp/dependency/RxSwift.xcframework; sourceTree = "<group>"; };
A521CACC25AD7A4B00151D51 /* PolarBleSdk.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = PolarBleSdk.xcframework; path = "../../polar-sdk-ios/PolarBleSdk.xcframework"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
6C770A52205269C800F3D51D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A5D3227825678D8100E8C9A2 /* RxSwift.framework in Frameworks */,
A5D322752566A06100E8C9A2 /* PolarBleSdk.framework in Frameworks */,
A521CACA25AD7A3A00151D51 /* RxSwift.xcframework in Frameworks */,
A521CACD25AD7A4B00151D51 /* PolarBleSdk.xcframework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -105,8 +105,8 @@
6C770A6A20526A9500F3D51D /* Frameworks */ = {
isa = PBXGroup;
children = (
A5D3227725678D8000E8C9A2 /* RxSwift.framework */,
A5D322742566A06100E8C9A2 /* PolarBleSdk.framework */,
A521CACC25AD7A4B00151D51 /* PolarBleSdk.xcframework */,
A521CAC925AD7A3A00151D51 /* RxSwift.xcframework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down Expand Up @@ -327,7 +327,8 @@
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -345,12 +346,15 @@
"$(PROJECT_DIR)/../",
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/../../polar-sdk-ios/",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = polarBleSdkTestApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/Frameworks/PolarBleSdk.framework";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/Frameworks/PolarBleSdk.framework",
);
PRODUCT_BUNDLE_IDENTIFIER = com.polar.polarBleSdkTestApp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -374,12 +378,15 @@
"$(PROJECT_DIR)/../",
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/../../polar-sdk-ios/",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = polarBleSdkTestApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/Frameworks/PolarBleSdk.framework";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/Frameworks/PolarBleSdk.framework",
);
PRODUCT_BUNDLE_IDENTIFIER = com.polar.polarBleSdkTestApp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Loading

0 comments on commit 452b49c

Please sign in to comment.