Cross-Platform Swift: UI Controls

Episode #294 • Sep 9, 2024 • Subscriber-Only

We will introduce UI controls and focus logic to our SwiftWasm application by leveraging a binding type inspired by SwiftUI, and we will see how similar even our view logic can look across many platforms.

Previous episode
Cross-Platform Swift: UI Controls
Next episode
Locked

Unlock This Episode

Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.

Sign in with GitHub

Introduction

Stephen

This is absolutely incredible. We are now powering a pretty complex web-based feature from our Swift code base. We have been able to share a ton of logic and behavior between different view paradigms and deployment platforms, and it’s all thanks to our dedicated effort to prioritize domain modeling over view-related concerns.

We have been very strict with ourselves to extract as much of the logic and behavior of our features into a dedicated observable model, rather than sprinkling that code throughout the view. And it is now paying off.

Brandon

But there is one last feature in our CounterModel that we explored for UIKit that we have not yet recreated in our web app. Back when dealing with UIKit we wanted to show how one can bind properties of an observable model to various UI controls, such as steppers and text fields. And we further wanted to show how even focus of text fields could be controlled via state.

Let’s explore what this looks like from the perspective of the web and Wasm.

Control bindings


Downloads

Get started with our free plan

Our free plan includes 1 subscriber-only episode of your choice, access to 64 free episodes with transcripts and code samples, and weekly updates from our newsletter.

View plans and pricing