Skip to content

Onyx Delivery is designed to retrieve the order bills list from the backend API, then ensure saving it into the SQL database (with written SQL statements), after that, the app displays the cashed bills list in the table view that appears to the user (I managed to have one and only one source to display the data from.. "Single source of truth").

Notifications You must be signed in to change notification settings

sala7khaled/ios-onyx-delivery

Repository files navigation

Onyx Delivery

Onyx Delivery is designed to retrieve the order bills list from the backend API, then ensure saving it into the SQL database (with written SQL statements), after that, the app displays the cashed bills list in the table view that appears to the user (I managed to have one and only one source to display the data from.. "Single source of truth").


Features

  • Singleton Design: The class employs the Singleton design pattern, ensuring that only a single instance of LocalDataSource can be created. This instance is accessed via the shared property.

  • Database Initialization: Upon instantiation, the class establishes a connection to an SQLite database located in the application's document directory.

  • Table Creation: The class creates an SQLite table named Bill if it does not already exist. This table is used to store bill-related information, including attributes such as number, date, tax, status, and customer.


Data Source Functions

I've made some functions to createTablesIfNeeded(),

    private func createTablesIfNeeded() {
        let createTableQuery = "CREATE TABLE IF NOT EXISTS Bill (number TEXT,
                                 date TEXT, tax TEXT, status TEXT, customer TEXT);"

        if sqlite3_exec(database, createTableQuery, nil, nil, nil) != SQLITE_OK {
            print("Error creating table")
        }
    }

upsertBills(bills: [Bill]), retrieveBills() -> [Bill], removeAllBills() in the LocalDataSource class.



Environment

This project was generated with:

  • IDE: Xcode
  • LNG: Swift
  • PATTERN: MVVM


Author

If you have any questions, please feel free to contact the project maintainer:



Preview

Launch Sign In New orders Other orders

About

Onyx Delivery is designed to retrieve the order bills list from the backend API, then ensure saving it into the SQL database (with written SQL statements), after that, the app displays the cashed bills list in the table view that appears to the user (I managed to have one and only one source to display the data from.. "Single source of truth").

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages