Skip to content

bdaralan/ShoB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShoB

A project aimed to build an order tracking iOS application and also to learn SwiftUI.

Status

In progress...

Goal

  • 100% SwiftUI
  • Intergrage CoreData & iCloud AutoSync
  • CloudKit Share Support
  • Dark Mode Support
  • Markdown Support
  • Generate Invoice PDF
  • Deploy

Preview

Order Scene

Order Scene Preview Order Input 01 Order Input 02

Customer Scene

Customer Scene Preview

Item Scene

Item Scene Preview

Store Scene

Store Scene Preview

Learning

This is a section for listing out documents, resources, thoughts, and approaches.

Core Data & iCloud Auto Sync

Since iOS 13 now supports Core Data auto sync with CloudKit, the project will take advantage of that.

Requirement:

  • Creating the Core Data Stack using NSPersistentCloudKitContainer instead of NSPersistentContainer.
  • The auto sync feature requires that all properties of NSManagedObject's Entity must be optional in the .xcdatamodeld file.

Resource:

CloudKit Share

Still on the list.

Dark Mode

To support dark mode out of the box, the project makes use of system colors such as Color.primary, .secondary, and .accentColor...

Markdown

Still on the list.

Generate PDF

Still on the list.

View

Model View View Model (MVVM)

The MVVM is used on most of the top level views to handle view update. Whereas, some of the inner views or views that are part of the top level views might only need @State or @ObservedObject properties.

  • Most top level views have their own view model either a struct or a class which conforms to ObservableObject.
  • Property Wrapper @Published is used in the class view model to get will-change signal from the publisher for the properties of interest.

Navigation View Push/Pop

There is a feature in the application to discard any unsaved changes when user tap on the navigation view's back button.

Until there is a native way of doing this, the approach right now is to use NavigationStateHandler object to setup action to perform when the view is pushed or popped.

Create/Read/Update/Delete Core Data Object

The approach right now is the make use of EnvironmentObject. There will be a concrete data source object specific to each type of model object that will handle all the actions.

The concrete data source object will conform to ObjectDataSource protocol. The protocol has all the methods for fetching, creating, reading, updating, deleting, and validating NSManagedObject. The ObjectDataSource protocol works hand in hand with ObjectValidatable protocol.

Therefore, views that have access to the EnvironmentObject will be able to access objects and methods to perform necessary actions.

Releases

No releases published

Packages

No packages published

Languages