Day143 — path to iOS developer

Jacky Tsang
1 min readFeb 26, 2021

Section 17

SwiftUI

  • VHZ Stack layout
  • Highly reusable UI component
  • Cross Platform (iPhone, iPad, Watch)

command + click

  • Embed in HStack/VStack/List
  • Extract SubView

preview custom layout NOT inside a phone bezel

Managing State

SwiftUI uses the @State property wrapper to allow us to modify values inside a struct, which would normally not be allowed because structs are value types.

Mutating Struct

Identifiable

computed properties

return objectID for id to mark it Identifiable

Create array instance

ObservableObject

NavigationLink

Construct a SwiftUI version of UIKit component

Summary

SwiftUI is at its early stage. It depends on apple to provide more features. UIKit has way more layout properties, but I can’t resist declarative ui.

--

--