Developer

Getting Started

Adding Judo to an Existing Project

If you have an existing app — or otherwise prefer to set up your Xcode project yourself — you can add new UI to your existing app with Judo by adding the SDK to your Xcode project.


Add the Judo SDK via SwiftPM

In order to render the UI built with Judo, add the Judo SDK to your project using Swift package manager.

The SDK is available at https://github.com/judoapp/judo-swiftui.

Select your project in the Project Navigator, ensure the project is selected in the main view, then select the Package Dependencies tab.


Drag your Judo file into your project

Drag your Judo file into your app's existing Xcode project. You can do so by dragging the file into Xcode (from Finder, for example) into the main source folder of your project.

Xcode will prompt you to select among a few options. Be sure to select Copy Items if Needed and also to add it to the main target of your app. Adding it to the target instructs Apple's build system to include the Judo file in your app's bundle, where it can be found at runtime.

Updating the Judo file in your project

Once you've moved or copied your Judo file into your Xcode project, you will need to update it with any future changes. Either you can make changes directly in the Judo file in your project (right click on the Judo file right in Xcode and use the external editor feature to open it directly in Judo) or you can replace it with an updated copy from elsewhere.

Adopt the workflow that best suits your use case.


Render the Judo UI using JudoView

Now the JudoView SwiftUI view has become available.

In ContentView.swift of your Xcode-generated app, you can add JudoView to your view body. The JudoView initializer takes a single argument, the name of the Judo file you want to render (without the file extension), here given as Main for Main.judo.

struct ContentView: View {
    var body: some View {
        JudoView("Main")
    }
}

JudoView will select and display the artboard marked as "prototype start point" in your Judo file by default.

404 error?

If you see a "404" message or similar when you run your app, verify that you've added that the Judo file to your app's target, otherwise the file won't be included in the app bundle.

Previous
Use Xcode Export to Start a New Project