Going fully declarative: Direct to SwiftUI.
Direct to SwiftUI is an adaption of an old WebObjects technology called Direct to Web. This time for Apple's new framework: SwiftUI. Instant CRUD apps, configurable using a declarative rule system, yet fully integrated with SwiftUI.
There is a blog entry explaining how to use this: Introducing Direct to SwiftUI.
This repo is a Direct to SwiftUI example application. It connects against database instances with the Sakila example database, aka "DVDRental".
It is preconfigured to use the PostgresClientKit adaptor, but should work w/ any ZeeQL adaptor, e.g. SQLite. PG is recommended because the PostgreSQL SQL catalog has high fidelity (e.g. SQLite doesn't even have a Date type). This allows D2S to provide a pretty good default ORM mapping schema from just the catalog.
The sample contains targets to build iOS, watchOS and macOS applications.
There is a version of this using CoreData instead of ZeeQL: DVDRentalCoreData.
Still too ugly to show, but works in a very restricted way ;-)
brew install PostgreSQL
brew services start postgresql # start at computer start
createuser -s postgres
Download and install Postgres.app, a nice UI wrapper to manage PostgreSQL databases.
curl -o /tmp/dvdrental.zip \
http://www.postgresqltutorial.com/wp-content/uploads/2019/05/dvdrental.zip
mkdir -p /tmp/dvdrental && cd /tmp/dvdrental
tar zxf /tmp/dvdrental.zip
tar xf /tmp/dvdrental.tar # crazy, right?
createdb dvdrental
pg_restore -h localhost -U postgres -d dvdrental .
$ psql -h localhost -U postgres dvdrental
psql (11.4)
Type "help" for help.
dvdrental=# \dt
List of relations
Schema | Name | Type | Owner
--------+---------------+-------+----------
public | actor | table | postgres
public | address | table | postgres
public | category | table | postgres
public | city | table | postgres
public | country | table | postgres
public | customer | table | postgres
public | film | table | postgres
public | film_actor | table | postgres
public | film_category | table | postgres
public | inventory | table | postgres
public | language | table | postgres
public | payment | table | postgres
public | rental | table | postgres
public | staff | table | postgres
public | store | table | postgres
(15 rows)
To create a backup copy of your database, run:
CREATE DATABASE dvdrental_org TEMPLATE dvdrental;
cd /tmp
wget https://raw.githubusercontent.com/jOOQ/jOOQ/master/jOOQ-examples/Sakila/sqlite-sakila-db/sqlite-sakila-schema.sql
wget https://raw.githubusercontent.com/jOOQ/jOOQ/master/jOOQ-examples/Sakila/sqlite-sakila-db/sqlite-sakila-insert-data.sql
sqlite3 dvdrental.sqlite3 < sqlite-sakila-schema.sql
sqlite3 dvdrental.sqlite3 < sqlite-sakila-insert-data.sql
sqlite3 dvdrental.sqlite3
sqlite> .tables
actor film payment
address film_actor rental
category film_category sales_by_film_category
city film_list sales_by_store
country film_text staff
customer inventory staff_list
customer_list language store
Brought to you by The Always Right Institute and ZeeZide. We like feedback, GitHub stars, cool contract work, presumably any form of praise you can think of.