Updated for Xcode 12.5
With its firm focus on declarative user interfaces, it should be no surprise that SwiftUI gives us a fantastic mechanism for building forms – collections of user input controls designed to gather information, such as an order form or a settings screen.
Even better, several parts of SwiftUI automatically adapt to being placed inside forms, with their appearance and behavior changing so they work better alongside other groups of input controls.
If you thought that was clever, you’re going to love this: SwiftUI actually dynamically adjusts the layouts to the point where it can make whole new screens automatically for us depending on what platform your code is running on – it fully decouples the purpose of our controls from their visuals. This means we describe what we want and SwiftUI figures out the idiomatic way to make that happen on the current platform.
Tip: Forms are regular containers just like
VStack, so you can switch between the two freely depending on your purpose.
SPONSORED ViRE offers discoverable way of working with regex. It provides really readable regex experience, code complete & cheat sheet, unit tests, powerful replace system, step-by-step search & replace, regex visual scheme, regex history & playground. ViRE is available on Mac & iPad.
Link copied to your pasteboard.