Appearance
Installation
Prerequisites
- A React Native app (0.60 or later, autolinking required)
- A Mac with Xcode and CocoaPods to build the iOS app (iOS builds are macOS-only)
- A GitHub account with access to the FizzUp GitHub Packages Maven repository, for Android
TIP
The package itself installs the same way on any OS. Only the iOS build (pod install, yarn ios) requires macOS. You can develop and build the Android side on macOS, Linux, or Windows.
Install the package
sh
yarn add trainingkit-reactnativeDuring local package development, use a relative file reference instead:
sh
yarn add file:../relative/path/to/trainingkit-reactnativeiOS setup
Install CocoaPods dependencies:
sh
cd ios
pod install
cd ..The podspec prepare_command fetches TrainingKit.xcframework from getfizzup/trainingkit-ios-sdk@main automatically during pod install. The framework is installed inside the package at ios/Vendor/TrainingKit.xcframework, not in the host app.
The host app does not need to add the TrainingKit Swift Package manually.
Fetching the framework manually
Normally you never need this — pod install fetches the framework for you. It is only useful during local package development, when you work inside the trainingkit-reactnative checkout itself. The fetch:ios-trainingkit script is defined in the package's package.json, so run it from the package root:
sh
yarn fetch:ios-trainingkitTo test against a different archive URL temporarily:
sh
TRAININGKIT_IOS_SDK_URL=https://github.com/getfizzup/trainingkit-ios-sdk/archive/refs/heads/main.zip yarn fetch:ios-trainingkitMigrating from a manually copied bridge
If your app previously contained native bridge files directly (before this package existed), remove them from the app target to avoid duplicate native modules:
TrainingKitModule.swiftTrainingKitModule.m- any custom
ClassicWorkoutControllerorStreamingWorkoutControllersubclasses copied only for the bridge
Android setup
The Android SDK is distributed through GitHub Packages. Add the FizzUp Maven repository to the app's Gradle configuration.
In android/build.gradle:
groovy
buildscript {
repositories {
google()
mavenCentral()
maven {
url "https://maven.pkg.github.com/getfizzup/trainingkit-android-sdk"
credentials {
username = properties.getProperty("GithubUser") ?: System.getenv("GITHUB_USERNAME")
password = properties.getProperty("GithubToken") ?: System.getenv("GITHUB_TOKEN")
}
}
}
}
allprojects {
repositories {
google()
mavenCentral()
maven {
url "https://maven.pkg.github.com/getfizzup/trainingkit-android-sdk"
credentials {
username = properties.getProperty("GithubUser") ?: System.getenv("GITHUB_USERNAME")
password = properties.getProperty("GithubToken") ?: System.getenv("GITHUB_TOKEN")
}
}
}
}Providing credentials
Provide GitHub credentials in android/local.properties:
properties
GithubUser=your-github-username
GithubToken=your-github-tokenOr through environment variables:
sh
export GITHUB_USERNAME=your-github-username
export GITHUB_TOKEN=your-github-tokenChromecast support
Chromecast integration is optional. To enable casting in the video workout flow, provide your Google Cast receiver application ID.
In android/local.properties:
properties
chromecastReceiverApplicationId=YOUR_CAST_APP_IDOr via environment variable:
sh
export CHROMECAST_RECEIVER_APPLICATION_ID=YOUR_CAST_APP_IDMigrating from a manually copied Android bridge
Remove the following files and declarations from the host app if they were previously copied from an older demo:
TrainingKitModule.ktTrainingKitReact.ktClassicWorkoutActivity.ktVideoWorkoutActivity.ktCastOptionsProvider.ktadd(TrainingKitReact())call inMainApplication.ktimplementation("com.fysiki:trainingkit:...")in the appbuild.gradle- manually declared TrainingKit activities in
AndroidManifest.xml
The package declares all of these itself.
Build the app
After installing native dependencies, rebuild the app. Metro reload is not sufficient after adding a native package.
sh
yarn ios
yarn android