Menu

 

Native

iOS library for integrating WeFitter and HealthKit into your app

Installation

Import WeFitterLib.xcframework into your project via General > Framework, Libraries, and Embedded Content

Usage

  •  - Before calling other functions make sure canConnectToHealthData returns true. For instance, HealthKit data is not available on an iPad.
  •  - In your ViewController, call configure in the viewDidLoad function with a WeFitterConfig object. configure should be called every time your app starts.
    •  - The token parameter 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.
    •  - The url parameter 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.
    •  - The startDate is optional. By default data of the past 20 days will be uploaded.
    •  - The enabledDataTypes is optional and is used to control which permissions are shown to the user. By default all datatypes will be requested.
    •  - The enableDailyDetail is optional and it used to enable uploading of daily detail. This wil result in a lot of extra processing and can slow down syncing of data when there is a lot of historic data. By default it is false.
    •  - The enableHeartRateSamples is optional and it used to enable uploading of heart rate samples. This wil result in a lot of extra processing and can slow down syncing of data when there is a lot of historic data. By default it is false.
  •  - After configure has succeeded you are able to call connect and disconnect. To see the current status you can call currentStatus. Only one profile can be connected at a time.

Example projects

Two example projects have been included, one in Swift, one in Objective-C. The SDK code itself is written in Swift.

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.

Objective-C

To use the SDK, use #import <WeFitterLib/WeFitterLib-Swift.h>. All available methods/properties/types are visible in this header file.

Thank you for reaching out!

We will be in touch with you soon. WeFitter team.

You are subscribed!

You will soon receive our newsletter!
WeFitter team.