How to show a live updates of view ?

How can playground or any app exec an swift code or show an update live of view that we are make?

I want to know this because i want to build app that help you to build views without coding..so i want the same Features that used on swift playground and xcode that exec swift code and show update live of view.

That's exactly what Preview does, isn't it ?

@Claude31 Did you now How its work? or how to build Similar?

I have never thought about it. But it must be a bit tricky, a.k.a simulator.

There are two ways to do it. By the way, in your Xcode project next to your code, there should be a live preview. If it doesn't show, just click on the button to resume live updates.

Way 1:

import SwiftUI


struct ContentView: View {

    var body: some View {

        // Place the content of your view here.

    }

}


struct ContentView_Previews: PreviewProvider {

    static var previews: some View {

        ContentView()

    }

}

Way 2:

import SwiftUI

import PlaygroundSupport


struct ContentView: View {

    var body: some View {

        // Place the content of your view here.

    }

}


PlaygroundPage.current.setLiveView(ContentView())
How to show a live updates of view ?
 
 
Q