Latest 0.9.12
Homepage https://github.com/FitnessKit/FitDataProtocol
License MIT
Platforms ios 10.0, osx 10.12, tvos 10.0, watchos 3.0
Dependencies DataDecoder, FitnessUnits, AntMessageProtocol
Authors

Swift4
Version
License
Platform

Swift Version of the Garmin Flexible and Interoperable Data Transfer Protocol.

Supports Revision 2.3

Installation

FitDataProtocol is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'FitDataProtocol'

Swift Package Manager:

    dependencies: [
        .Package(url: "https://github.com/FitnessKit/FitDataProtocol", from: 0.9.12)
    ]

How to Use

let fileUrl = URL(fileURLWithPath: "WeightScaleMultiUser" + ".fit")
let fileData = try? Data(contentsOf: fileUrl)

if let fileData = fileData {
    var decoder = FitFileDecoder(crcCheckingStrategy: .throws)

    do {

        try decoder.decode(data: fileData,
                       messages: FitFileDecoder.defaultMessages,
            decoded: { (message: FitMessage) in

                print("Got Message: (message)")

                if message is FileIdMessage {
                    let message = message as! FileIdMessage
                    print("mssage", message.deviceSerialNumber)
                }

                if message is RecordMessage {
                    let message = message as! RecordMessage
                    records.append(message)
                }

                if message is SportMessage {
                    let message = message as! SportMessage
                    sports.append(message)
                }

                if message is ActivityMessage {
                    let message = message as! ActivityMessage
                    activity.append(message)
                }
        })

    } catch {
        print(error)
    }
}

Author

Kevin A. Hoogheem

License

FitDataProtocol is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "FitDataProtocol",
    "version": "0.9.12",
    "summary": "Garmin Flexible and Interoperable Data Transfer Protocol.",
    "description": "Swift version of the Garmin Flexible and Interoperable Data Transfer Protocol.",
    "homepage": "https://github.com/FitnessKit/FitDataProtocol",
    "documentation_url": "https://fitnesskit.github.io/FitDataProtocol/",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Kevin A. Hoogheem": "[email protected]"
    },
    "source": {
        "git": "https://github.com/FitnessKit/FitDataProtocol.git",
        "tag": "0.9.12"
    },
    "platforms": {
        "ios": "10.0",
        "osx": "10.12",
        "tvos": "10.0",
        "watchos": "3.0"
    },
    "source_files": "Sources/FitDataProtocol/**/*",
    "dependencies": {
        "DataDecoder": [
            "~> 4.0.3"
        ],
        "FitnessUnits": [
            "~> 1.6.1"
        ],
        "AntMessageProtocol": [
            "~> 0.2.1"
        ]
    }
}

Pin It on Pinterest

Share This