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 7 days will be uploaded.
  • 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.

You are subscribed!

You will soon receive our newsletter!
WeFitter team.
footer_bg