Skip to content

Embed in iOS apps

Overview

This page explains how to embed a Minsar experience in your iOS (Swift) app and explains the scenarios and options available.

Availability

iOS Embed will be available to all Minsar users by the end of the year.

Beta Testers only

The documentation below only applies to Minsar Insiders using a pre-release version of Minsar.

Getting Started

Prerequisites

The MinsarKit SDK requires:

  • Xcode 11+
  • iOS SDK 13+

Dependencies

MinsarKit can easily be added to your project using CocoaPods or by adding the MinsarKit.framework file in the Embedded Binaries section of your Xcode project.

With CocoaPods

You may update your Podfile as below:

platform :ios, '13.0'

target '%APP_NAME%' do
  use_frameworks!

  pod ‘MinsarKit', :http => "https://minsar.dev/sdks/ios/latest.zip"
end

Manual import

SDK lifecycle

SDK Initialization

The MinsarKit SDK must be initialized before attempting to open an experience:

MinsarKit.shared.initSDK(apiKey:String)

The API Key can be retrieved in the Portal.

This call will throw if the apiKey is invalid, or if the device doesn't support AR.

The SDK can be safely initialized at any moment, such as in your AppDelegate's didFinishLaunchingWithOptions method.

SDK Destruction

Before quitting, the MinsarKit should be destroyed:

MinsarKit.shared.terminateSDK()

Play an experience

Once the SDK is initialized, developers can play an experience with a single line of code:

MinsarKit.shared.play(experienceId: String, renderer: MTKView?)

The renderer parameter is optional: if it isn't set, MinsarKit will play the experience in fullscreen.

It will throw if:

  • the experienceId is invalid (bad formatting)
  • the experience is not found or has no associated Launch Plan
  • the device can't play this experience
  • MinsarKit can’t open this experience for compatibility reasons
  • MinsarKit is already playing an experience

Stop

Developers are responsible of stopping the experience visualization:

MinsarKit.shared.stop()

Samples

Coming soon.