Skip to content

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

Notifications You must be signed in to change notification settings

Dbhardwaj99/Appetizer-Swift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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)

Topics

Resources

Stars

Watchers

Forks

Languages