# App Initialisation

## TyroTapToPay(environment: TyroEnvironment, connectionProvider: ConnectionProvider)


```swift
public convenience init(
  environment: TyroTapToPaySDK.TyroEnvironment,
  connectionProvider: TyroTapToPaySDK.ConnectionProvider
) throws
```

### Parameters


```json
{
  "type": "object",
  "properties": {
    "environment": {
      "type": "TyroEnvironment",
      "description": "An enumeration representing the available environments for use with Tap to Pay.",
      "enum": [
        "TyroEnvironment.sandbox",
        "TyroEnvironment.prod"
      ]
    },
    "connectionProvider": {
      "type": "ConnectionProvider",
      "description": "Your class that implements the Connection Provider interface which makes a call to your server to fetch the `connectionSecret`."
    }
  },
  "required": [
    "environment",
    "connectionProvider"
  ]
}
```

See [TyroEnvironment](/docs/in-person-payments/tap-to-pay/integration-guide/sdk/ios/sdk/tyro-environment) for the different environments the SDK can be initialised with.

See [ConnectionProvider](/docs/in-person-payments/tap-to-pay/integration-guide/sdk/ios/sdk/connection-provider) for information about the provider you need to implement to return a `connectionSecret`.

### Throws

#### TapToPaySDKError.tapToPayInitialisationError

Throws `TapToPaySDKError.tapToPayInitialisationError` if there was an issue determining the version of the SDK

See [TapToPaySDKError](/docs/in-person-payments/tap-to-pay/integration-guide/sdk/ios/sdk/errors) for more information about errors.

## tapToPaySdk.connect() async throws

Prepares the Tyro Tap to Pay SDK to communicate with your POS integration server and the reader device


```swift
public func connect() async throws
```