# Integrate a framework

{% hint style="info" %}
*The guide assumes you* [*have*](https://modelplace.gitbook.io/mobile/getting-started/get-a-framework) *already got* [*a framework*](https://modelplace.gitbook.io/mobile/getting-started/get-a-framework) *and* [*run a demo application*](https://modelplace.gitbook.io/mobile/getting-started/run-a-demo)*. If you haven't done it yet please* [*get back to the previous steps*](https://modelplace.gitbook.io/mobile/getting-started)*.*
{% endhint %}

### Frameworks API

Provided frameworks have a public interface to be used in custom iOS apps. To integrate the framework into your app, use the corresponding API methods.

{% hint style="info" %}
*Go to* [*Face Detection API*](https://modelplace.gitbook.io/mobile/api/face-detection) *and* [*Pose Tracking API*](https://modelplace.gitbook.io/mobile/api/pose-tracking) *to learn how to integrate a framework into your mobile application.*
{% endhint %}

### Framework Integration

*Follow the steps below to start using a framework in your application*

**1.** **Copy** *framework* into the root of the target application

```shell
cp -R frameworks/ModelFramework.framework /path/to/project/frameworks
```

**2. Open** your application in XCode

**3. Disable** Bitcode embedding

`Project.xcodeproj -> Build Settings -> Build Options -> Enable Bitcode`

<figure><img src="https://2410799202-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7SyZCuKNQRnkSQ3rknvP%2Fuploads%2FakXSB6LbMncCBtFlHKa7%2Fbitcode.png?alt=media&#x26;token=a76e59df-82a9-498c-b4e0-5a02012135f5" alt=""><figcaption></figcaption></figure>

**4.** **Set** *Framework Search Paths* to `/path/to/project/frameworks`

`Project.xcodeproj -> Build Settings -> Search Paths -> Framework Search Paths`

<figure><img src="https://2410799202-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7SyZCuKNQRnkSQ3rknvP%2Fuploads%2FszpkdooftT0HsTps0XgT%2Fframeworks-search-path.png?alt=media&#x26;token=68a30e7c-76d8-41d5-8469-7e37ff89ea63" alt=""><figcaption></figcaption></figure>

**5. Import** the framework public headers in the bridging header

```objectivec
#ifndef PROJECT_BRIDGING_HEADER_H
#define PROJECT_BRIDGING_HEADER_H

// ...

#import <ModelFramework/ModelFramework.h>

#endif // !PROJECT_BRIDGING_HEADER_H
```

{% hint style="warning" %}
*For Swift-only projects bridging header is required to generate bindings for class from Objective-C frameworks.*

If it's not created yet or/and the project doesn't have any Objective-C code, add a new header file to the project root named `$(PROJECT_NAME)-Bridging-Header.h` (It's the most common naming convention).

Update the path to the bridging header:\
`Project.xcodeproj -> Build Settings -> Swift Compiler - General -> Objective-C Bridging Header`to point to the generated header.
{% endhint %}

<figure><img src="https://2410799202-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7SyZCuKNQRnkSQ3rknvP%2Fuploads%2FvV5XfzSQ5sczjWHfb4y8%2Fbridging-header-path.png?alt=media&#x26;token=367d4245-125a-4317-887b-fe3f294f095b" alt=""><figcaption></figcaption></figure>

**6. Link** *application target* with the framework

`Project.xcodeproj -> Application Target -> Build Phases -> Link Binary with Libraries`

<figure><img src="https://2410799202-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7SyZCuKNQRnkSQ3rknvP%2Fuploads%2FKQOCaZR70smT07gUTNOk%2Flink-against-framework.png?alt=media&#x26;token=68d174d0-8c12-4e58-9253-3e8b1622483d" alt=""><figcaption></figcaption></figure>

**7.** **Sign and embed** the framework

`Project.xcodeproj -> Application Target -> General -> Frameworks, Libraries, and Embedded Content`

<figure><img src="https://2410799202-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7SyZCuKNQRnkSQ3rknvP%2Fuploads%2FTtNCcv5niHZjGQKe3xsk%2Fframework-embedding.png?alt=media&#x26;token=82fdb9d8-d985-4053-8f06-feb7875cedce" alt=""><figcaption></figcaption></figure>

**8.** **Build and run** the application on the target device
