Setting up Remodel-AR in UIKit

Creating and configuring an Xcode project that uses Remodel-AR.

Step 1

Create a new project using the iOS App template.

Step 2

Enter “Painty” as the Product Name. Select “Storyboard” from the Interface pop-up menu then click Next.

Step 3

Choose a location to save the Painty project on your Mac.

Step 4

Navigate to the Targets->Painty->General tab. Scroll down to the “Frameworks, Libraries, and Embedded Content” section and click on the Add Items button.

Step 5

Click on “Add Other…”, then “Add Files…”. Navigate to and select the RemodelAR.xcframework file and click Add.

Step 6

Navigate to the Targets->Painty->Info tab. Add a new entry for the “Privacy - Camera Usage Description” key. Give it a description.

Step 7

Next add a new entry for the “Privacy - Photo Library Usage Description” key. Give it a description.

Step 8

Next you'll need to configure your license key when the app starts. Open AppDelegate.swift and modify didFinishLaunchingWithOptions to configure the license on startup. Next replace "license_key" with the license key you were provided. If you need a license key, please contact support@passiolife.com

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Replace "license_key" with your license key
        PassioConfiguration.configure(license: "license_key")
        
        return true
    }

Step 9

Open ViewController.swift and import the RemodelAR and ARKit frameworks.

import ARKit
import RemodelAR

Step 10

Open Main.storyboard and add an ARSCNView object and setup its constraints to fill the view. Next, connect the ARSCNView outlet to ViewController.swift as arscnView.

Step 11

In ViewController.swift, create a new variable to contain the ARController object.

private var arController: ARController?

Step 12

Create an extension and add a new method, configureView() to it. Inside configureView(), assign arController and start the scene as shown below. The RemodelARLib method can be changed to use any of the available methods.

extension ViewController {
    private func configureView() {
        arController = RemodelARLib.makeFloorplanARController(with: arscnView)
        arController?.startScene(reset: true)
    }
}

Step 13

Call configureView() from ViewController’s ViewWillAppear() method.

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    configureView()
}

Step 14

Build and run the project. You should see a camera view, and if you move the camera back and forth over a floor area you should see a grid cover the ground. The project is now ready to create a UI to access the required features. In the next step, you'll add a color picker to change the color used to paint the walls.

The final project code to this point is included here for your convenience.

If at any point you need help from the Passio team, please reach out to us at support@passiolife.com

Last updated