# Installing the SDKs

Source: https://appfig.com/docs/package-manager-setup

How to add AppFig to your project on each platform. The SDKs are published at
[github.com/smartconfigui/AppFig-SDKs](https://github.com/smartconfigui/AppFig-SDKs);
the current version is **2.5.0**.

## iOS

Minimum: iOS 12.

### Swift Package Manager

1. In Xcode: **File > Add Package Dependencies**
2. Enter the URL:
   ```
   https://github.com/smartconfigui/AppFig-SDKs
   ```
3. Choose version `2.5.0` or later and add the **AppFigSDK** library to your app target.

### CocoaPods

Add to your `Podfile`, then run `pod install`:

```ruby
pod 'AppFigSDK', :git => 'https://github.com/smartconfigui/AppFig-SDKs.git', :tag => 'v2.5.0'
```

The pod is installed from the Git repository; it is not on the CocoaPods trunk, so
`pod 'AppFigSDK'` without `:git` will not find it.

### Import

```swift
import AppFigSDK
```

The class you call is `AppFig`; the module you import is `AppFigSDK`.

### Updating from 2.0.0 or earlier with a manually added framework

The framework was renamed from `AppFig.xcframework` to `AppFigSDK.xcframework` so that
its name matches its module. If you added the framework to Xcode by hand, remove the old
one and add `ios/AppFigSDK.xcframework`. Your code does not change.

## Android

Minimum: Android 5.0 (API 21).

1. Add the dependency to your app module (`build.gradle`):
   ```gradle
   dependencies {
       implementation 'com.appfig:appfig-android:2.5.0'
   }
   ```
   In `build.gradle.kts`: `implementation("com.appfig:appfig-android:2.5.0")`.
2. Import:
   ```kotlin
   import com.appfig.sdk.AppFig
   ```

The SDK is on Maven Central, which a standard Android project already has in its
repositories (`mavenCentral()`). Projects that installed it from JitPack
(`com.github.smartconfigui:AppFig-SDKs`) keep working; use one or the other, not both.

The libraries the SDK needs (OkHttp, Gson, the Kotlin standard library) are pulled in
automatically.

## Flutter

Minimum: Android 5.0 (API 21), iOS 12.

Add to `pubspec.yaml`:

```yaml
dependencies:
  appfig_flutter:
    git:
      url: https://github.com/smartconfigui/AppFig-SDKs.git
      path: flutter
      ref: v2.5.0
```

```dart
import 'package:appfig_flutter/appfig_flutter.dart';

await AppFig.init(companyId: 'your-company', tenantId: 'your-app', env: 'prod', apiKey: 'your-api-key');
final value = await AppFig.getFeatureValue('my_feature');
```

The package uses the native Android and iOS SDKs underneath, so nothing else has to be
added to the Android or iOS projects. It is installed from Git; it is not on pub.dev.

## Unity

Minimum: Unity 2021.3.

In Unity: **Window > Package Manager > + > Add package from git URL**, then enter:

```
https://github.com/smartconfigui/AppFig-SDKs.git?path=/unity#v2.5.0
```

The tag at the end pins the version; change it to update. The same address works as a line
in `Packages/manifest.json`: `"com.appfig.sdk": "<that address>"`. The SDK works in Mono and
IL2CPP builds, including with Managed Stripping Level set to High.

On older Unity versions, download `unity/AppFigUnitySDK.dll` from the
[SDK repository](https://github.com/smartconfigui/AppFig-SDKs/tree/v2.5.0/unity) and place it
in `Assets/Plugins/AppFig/` instead. See the [Unity guide](https://appfig.com/docs/unity-integration).

## React / Web

Download `react/AppFigReactSDK.js` and `react/AppFigReactSDK.d.ts` from the
[SDK repository](https://github.com/smartconfigui/AppFig-SDKs/tree/main/react) and add them
to your project:

```typescript
import AppFig from './AppFigReactSDK';
```

See the [React/Web guide](https://appfig.com/docs/react-web-guide).

## Next Steps

- **[iOS Integration](https://appfig.com/docs/ios-integration)**
- **[Android Integration](https://appfig.com/docs/android-integration)**
- **[Unity Integration](https://appfig.com/docs/unity-integration)**
- **[React/Web Guide](https://appfig.com/docs/react-web-guide)**
