Remodel-AR
  • Overview
  • ios guides
    • iOS Quick Start
    • iOS Walkthrough
      • SwiftUI Walkthrough
        • Section 1 - Setting up Remodel-AR in SwiftUI
        • Section 2 - Add a color picker
        • Section 3 - Add Export Features
        • Section 4 - Add Textured Paints
      • UIKit Walkthrough
        • Setting up Remodel-AR in UIKit
        • Adding a Color Picker
        • Getting to know Lidar scanning
        • Getting to know Legacy
        • Getting to know Floorplan
        • Getting to know Shader Paint
        • Section 2 - Add a color picker
        • Section 3 - Add Export Features
        • Section 4 - Add Textured Paints
    • iOS Library Documentation
      • Classes
        • ARController
        • ARStateModel
        • RemodelARLib
        • PassioConfiguration
      • Structures
      • Enumerations
      • Protocols
  • android guides
    • Android Quick Start
    • Android Walkthrough
      • Setting up Remodel-AR in Android
      • Paint Approaches
      • Getting to know Legacy
      • Getting to know Floor Plan
      • Getting to know Shader Approach
    • Android Library Documentation
      • Classes
        • PaintARActivity
        • OnCornerPlaced
        • GetWallPatchInfos
        • GetSavedImage
        • GetRawCameraImage
        • PassioSDKStatus
        • WallPatchInfo
    • ❔FAQs
Powered by GitBook
On this page
  1. ios guides
  2. iOS Walkthrough
  3. SwiftUI Walkthrough

Section 1 - Setting up Remodel-AR in SwiftUI

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

PreviousSwiftUI WalkthroughNextSection 2 - Add a color picker

Last updated 1 year ago

Step 1

Create a new project using the iOS App template.

Step 2

Enter “Painty” as the Product Name. Select “SwiftUI” 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

First you'll need to configure your license key when the app starts. Open PaintyApp.swift and add the init() block below, then replace "license_key" with the license key you were provided. If you need a license key, please contact support@passiolife.com

    init() {
        // Replace "license_key" with your license key
        PassioConfiguration.configure(license: "license_key")
    }

Step 8

Open ContentView.swift and you’ll see the default Hello World code.

//
//  ContentView.swift
//  Painty
//

import SwiftUI

struct ContentView: View {
    var body: some View {
        Text("Hello, world!")
            .padding()
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

Step 9

import RemodelAR
import SwiftUI

struct ContentView: View {
    @StateObject var model = ARStateModel()

    var body: some View {

Step 10

Create an extension to ContentView and create a variable for the ARView object.

private extension ContentView {
    var arView: ARView {
        RemodelARLib.makeARView(model: model, arMethod: .Lidar)
    }
}

Step 11

Add the arView object to the view body.

    var body: some View {
        arView
            .edgesIgnoringSafeArea(.all)
    }

Step 12

Build and run your project. You will see the walls start to be covered with a mesh. Tap on a mesh and it will be colored.

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

Import the Remodel-AR library and add the required @StateObject:

ARStateModel