Skip to content

Embed in iOS apps

Overview

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

Availability

iOS Embed will be available to all Minsar users by September 2021.

Beta Testers only

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

Getting Started

Samples

Documentation on the SDK is found below, though you might want to see the source code of an app that would use MinsarKit. We provide a few samples here: Minsar SDK Samples repository on Github.

These apps will be made available on the iOS App Store and Google Play Store for demonstration purposes.

Prerequisites

The MinsarKit SDK requires:

  • Xcode 12+
  • iOS SDK 14+

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, '14.0'

target '%APP_NAME%' do
  use_frameworks!

  pod ‘MinsarKit', :http => "$CONTACT_US_FOR_SDK_URL"
end

Manual import

SDK lifecycle

SDK Initialization

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

MinsarKit.shared.init(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.terminate()

Play an experience

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

MinsarKit.shared.openExperience(experienceId: String, sceneId: 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 mandatory experienceId or optional sceneId is invalid (a GUID is expected)
  • MinsarKit is already playing an experience
  • 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

Enter or Leave XR

MinsarKit.shared.enterXr() or MinsarKit.shared.exitXr()

Enter or leave fullscreen

MinsarKit.shared.enterFullscreen() or MinsarKit.shared.exitFullscreen()

Close an experience

Developers are responsible of stopping the experience visualization:

MinsarKit.shared.closeExperience()