This is a simple iOS list app (to-do list, tasks, shopping list, recipes, and the like) built with SwiftUI, showcasing the implementation of CRUD operations with DAO pattern.
iOS 14 or higher is required to run the app. If there is a need to support earlier versions of iOS, refer to a similar project, list-ios.
- Display a list of items (
List
,ForEach
) - Navigate to a page to add or edit items
(
NavigationLink
, custom view withForm
andTextField
) - Swipe to delete items (
onDelete(perform:)
) - Store items in database (DAO, SQLite)
The project implements a data access layer with the Data Access Object (DAO) pattern. It uses generics, inheritance and Singleton pattern to make the creation of data access objects, as well as performing CRUD operations easier.
The data access layer is built on top of the GRDB library. However, a version built on top of the FMDB library can be found on the fmdb branch.
Otherwise, if you are looking for an alternative database option other than SQLite, check out the integration of SwiftUI and Realm on the realm branch.
This project also implements a widget that can be added to the Home screen, with the following features:
- Display a list of items from a database shared between the app and widget (SQLite database stored in an App Group container)
- Tap the widget to launch the app
- For medium and large widgets:
- Tap the Add button to launch the app's New Item screen
(Deep linking with a
Link
control,onOpenURL(perform:)
,NavigationLink(destination:isActive:)
) - Tap a list item to launch the app's Edit Item screen
(Deep linking with
Link
controls,onOpenURL(perform:)
,NavigationLink(destination:tag:selection:)
)
- Tap the Add button to launch the app's New Item screen
(Deep linking with a
- Widget will be updated when list items are modified from the app
(using
WidgetCenter
'sreloadTimelines(ofKind:)
)
The project includes a sample implementation of UI test using the XCTest framework.
- GRDB
- Xcode 13.3 or higher
- iOS 14 or higher
- Swift 5 or higher