← Back to notebook index

Notebook Topic

Swiftui

English topic guide inspired by the original iOS Developer Notebook, expanded for both iOS and Android teams.

What this topic covers

Execution checklist

iOS implementation notes

Android implementation notes

Code examples

Swift

struct ProfileView: View {
    @StateObject private var vm = ProfileViewModel()
    var body: some View {
        Group {
            if vm.loading { ProgressView() }
            else { Text(vm.user?.name ?? "-") }
        }.task { await vm.load() }
    }
}

Kotlin

@Composable
fun ProfileScreen(vm: ProfileVm = viewModel()) {
    val state by vm.state.collectAsState()
    when {
        state.loading -> CircularProgressIndicator()
        else -> Text(state.user?.name ?: "-")
    }
}

Reference links

Related topics