> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/sdks/sdk-mobile/ios-sdk/inicializacion/lanzamiento-simplificado.md).

# Lanzamiento simplificado

## Inicializar el SDK

El SDK funciona a través de un **controlador principal (`SDKController`)**. Facephi proporcionará el `apiKey` de la licencia necesario para la inicialización.

```swift
 import core
 import sdk
 import trackingComponent
 
 ...
 
 let trackingController = TrackingController(
     trackingError: { trackingError in
         self.log("TRACKING ERROR: \(trackingError)")
     },
     enableLocation: false)

SDKController.shared.initSdk(licensingUrl: SdkConfigurationManager.LICENSING_URL, apiKey: SdkConfigurationManager.APIKEY_LICENSING, output: { sdkResult in
    if sdkResult.finishStatus == .STATUS_OK {
        self.log("Licencia automática seteada correctamente")
    } else {
        self.log("Ha ocurrido un error al intentar obtener la licencia: \(sdkResult.errorType)")
    }
}, trackingController: trackingController)

```

## Iniciar operación

Antes de lanzar cualquier componente, es obligatorio **iniciar una operación**.

Este método tiene 3 parámetros de entrada:

* **operationType**: Indica si se va a hacer un proceso de ONBOARDING o de AUTHENTICATION.
* **customerId**: Identificador del usuario (controlado a nivel de aplicación).
* **steps**: Lista de pasos de la operación si se han definido previamente:

**- Pasos definidos**:

{% code overflow="wrap" %}

```swift
SDKController.shared.newOperation(operationType: OperationType.X, customerId: "customerId", steps: [.SELPHI, .SELPHID, .OTHER("CUSTOM_STEP")], output: { _ in })
```

{% endcode %}

**- Pasos no definidos:**

{% code overflow="wrap" %}

```swift
SDKController.shared.newOperation(operationType: OperationType.X, customerId: "customerId", output: { _ in})
```

{% endcode %}

## Lanzamiento de componentes

Cada componente tiene su propio controlador y se lanza desde `SDKController`.

{% code overflow="wrap" %}

```swift
public func launchExample(setTracking: Bool = true,viewController: UIViewController,componentConfigurationData: ComponentConfigurationData)
{
    let output: (SdkResult<ExampleResult>) -> Void = { exampleResult in
        print("exampleResult: \(exampleResult.finishStatus)")
    }
        
    let controller = ExampleController(data: exampleConfigurationData, output: output, viewController: viewController)
        
    if setTracking {
        SDKController.shared.launch(controller: controller)
    } else {
        SDKController.shared.launchMethod(controller: controller)
    }
}
```

{% endcode %}
