- Getting Started
- Mobile SDKs
iOS library for integrating WeFitter and HealthKit into your app
WeFitterLib.xcframework into your project via
Framework, Libraries, and Embedded Content
- Before calling other functions make sure
canConnectToHealthDatareturns true. For instance, HealthKit data is not available on an iPad.
- In your ViewController, call
viewDidLoadfunction with a
configureshould be called every time your app starts.
tokenparameter is required which should be a valid WeFitter API profile bearer token. You receive this when the WeFitter profile was created using the WeFitter API.
urlparameter is optional and defaults to
https://api.wefitter.com/api/. Only provide an url if you want your own backend to acts as a proxy that forwards calls to WeFitter API. The url should be without
v1.3/ingest/as the library will append WeFitter API version itself.
startDateis optional. By default data of the past 20 days will be uploaded.
configurehas succeeded you are able to call
disconnect. To see the current status you can call
currentStatus. Only one profile can be connected at a time.
Two example projects have been included, one in Swift, one in Objective-C. The SDK code itself is written in Swift.
Where you need the SDKs functionality, use
import WeFitterLib and all relevant method calls are available. Note that there or some methods/properties/types with an
@objc annotation. Use them only if needed. For instance, use the
Status pure Swift enum, and not the
_Status enum that is a simplified enum. The underscore (
_) as starting character is an indication that the method should only be used from Objective-C, and there is a proper Swift equivalent.
To use the SDK, use
#import <WeFitterLib/WeFitterLib-Swift.h>. All available methods/properties/types are visible in this header file.