Day 17 Complete

2022-07-13 2 min read

Day 17 has is part two of project one of the 100 Days of SwiftUI Challenge. This final part of the project completes building the WeSplit application. Tomorrows part three covers a recap of the information and a couple of challenges to complete.

I’ve written some notes below to help me remember the topics covered in this project.

A non exhaustive list of techniques and elements covered in the WeSplit app

  • NavigationView
  • Form
  • Section
  • TextField
  • Picker
  • ForEach
  • Text
  • Button
  • Spacer
  • ToolbarItemGroup

Modifiers

  • .focused
  • .toolbar
  • .keyboardType
  • .navigationTitle

Other concepts

  • Fixing the numeric .decimalPad (numeric keypad) so it doesn’t stick around permanently (place done button in a .toolbar(ToolbarItemGroup)).
  • Using Pickers and the different types of Pickers, here we use the standard picker and then also the segmented picker for the percentages, so users aren’t taken to another view (screen).
  • Using Locale.current.currencyCode to allow a user to use their currently local set currency.
  • @State is used for values you want to set. To set values in SwiftUI code you need to reference @State values with a dollar sign $likeThis.
  • @FocusState is used for toggling the focus for a particular element (related to the keyboard issue mentioned above).
  • Reading the quick help of Section shows that it is a Struct with initialisers for header, footer closures.
  • How to add a title to a section instead of using a Text element (using the afore mentioned header: {} closure following the Section{}). It presents text nicely above the segmented percentage picker.