Add Form on iOS
This guide explains how to integrate Joyfill iOS SDK into a new or existing iOS project using SwiftUI By the end, you’ll be able to display a Form.Requirements
- A Mac running macOS
- The latest stable version of Xcode
Creating your project
Skip this step if you’re using an existing project. If you’re starting a new iOS app, follow the steps below. Steps:- Open Xcode and select File > New > Project.
- Select the iOS tab and choose the App template.
- Enter your product name (for example, Joyfill-Demo) and organization identifier (for example, com.example).
- Click Next, choose a location to save the project, and click Create.
Adding Joyfill to your project
Steps:- In Xcode, select your project.
- Go to the Package Dependencies tab and click +.
-
Enter the Joyfill Swift Package URL into the search field:
-
In the Dependency Rule fields, select:
- Version > Up to Next Minor — for controlled updates
-
Click Add Package. Confirm the addition.
In this confirmation step, ensure that the Add to Target column displays the correct target (usually the app target), and that the checkbox on the left is selected. For many projects — especially newly created ones — there will only be one target, so you can click the Add Package button again. However, for more complex projects with multiple targets, it’s important to double-check this setting.
Displaying a Form
Steps:- Add your JSON file to the project by dragging it into the Xcode project navigator. Click Finish when prompted. 1.1 Here is an example json you can use first-form.json
-
In your SwiftUI view, import the Joyfill SDK:
-
Display the Form using the following code:
- Build and run your application.