Weekly Swift articles, podcasts and tips by John Sundell.

Using SwiftUI without the macOS beta

Published on 13 Jun 2019
Basics article available: SwiftUI

You can totally start learning and experimenting with SwiftUI on iOS without running the macOS 10.15 beta. Just fire up a playground, import PlaygroundSupport, and assign a UIHostingController as your live view. It’s just the new Canvas feature that only works on 10.15.

import SwiftUI
import PlaygroundSupport

struct MyView: View {
    var body: some View {
        Text("Hello, world!")

let vc = UIHostingController(rootView: MyView())
PlaygroundPage.current.liveView = vc