Dbhardwaj99 / Appetizer-Swift

A food ordering app using swift for ios, An iOS learning project 🍟 (SwiftUI, Codable, NSCache, reduce, XCTest/XCUITest)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Appetizer

Appetizer is a project to practice and learn iOS development. Learning how to fetch JSON data, caching and showing alerts, is the main goal of this App.

Screens

image

App Store

This App is not available on the App Store.

Used Technologies

  • Swift 5.5
  • SwiftUI
  • Codable
  • JSON
  • Combine (for getting JSON data)
  • XCTest

SwiftUI

  • Form, Section
  • ProgressView
  • TabView
  • Toggle

Learnings

General

SwiftUI

UserDefaults

  • Shall ONLY be used for storing some lightweight user preferences!
  • Gets deleted when the App is deleted! So don't save any user critical data in there!

AsyncImage

Property Wrappers for handling and passing data

  • @State: SwiftUI will manage the state of a struct property separately for us so that it doesn't get destroyed when a struct view gets recreated. When a @State value changes, the view invalidates is appearance and recomputes the views body. @State is used for private properties that belong to a specific view and never get used outside of its local scope.
  • @StateObject: used to observe an object which conforms to the ObservableObject protocol (eg. viewModel). The body of a view will be recreated when this object changes.
  • @Binding: It connects a property to a source of truth stored elsewhere and can r&w its value.
    • For prototyping, we can use a constant binding: .constant()
  • @ObservableObject: used when passing in a value (e.g. viewModel class) from outside (reference) that shall be observed. Get's destroyed when a view gets recreated!
  • @EnvironmentObject: used to observe an object which is supplied by a parent view to its ancestor views.
  • Some differences

About

A food ordering app using swift for ios, An iOS learning project 🍟 (SwiftUI, Codable, NSCache, reduce, XCTest/XCUITest)


Languages

Language:Swift 100.0%