Lighter Examples

Examples for the Lighter SQLite environment, SwiftUI and server side.

Note: The examples require Swift 5.7 / Xcode 14b for proper plugin support.

When embedding a package using Enlighter (like NorthwindSQLite.swift), a local package seems to be required w/ the Xcode 14 beta (3…5). Otherwise the Swift package plugins do not seem to run. In the example project this is the “AppLogic” package. If Xcode gets stuck or doesn’t run the plugin, a package update sometimes help.

Northwind Database

The Northwind database is a common database example that has been ported to SQLite. Lighter provides a Swift version of that in the NorthwindSQLite.swift repository.

Note: The particular SQLite version of the Northwind database is quite lacking. For example booleans are stored as TEXTs, many columns are inappropriately marked as NULLable. That actually makes it a good example on how to deal with such databases in Lighter.

The Swift Northwind API: Documentation.

Examples

  • Northwind Database:
    • NorthwindWebAPI (A server side Swift example exposing the DB as a JSON API endpoint, and providing a few pretty HTML pages showing data contained.)
    • NorthwindSwiftUI (A SwiftUI example that lets one browse the Northwind database. Uses the Lighter API in combination with its async/await supports.)
  • Custom database:
    • Bodies (A SwiftUI example which loads a list of solar bodies from the web and keeps an offline-first, local cache in a SQL source based Lighter setup.)

Dependencies

This example pulls in a lot of bigger dependencies. A real Lighter project can actually work w/ no external dependencies at all.

Screenshots

Northwind SwiftUI

Screenshot 2022-08-16 at 16 41 31

Northwind Web API

MacroSample-Product-List

Macro-Sample-Product-Detail

Solar Bodies

Screenshot 2022-08-12 at 16 05 09

Who

Lighter is brought to you by Helge Heß / ZeeZide. We like feedback, GitHub stars, cool contract work, presumably any form of praise you can think of.

Want to support my work? Buy an app: Code for SQLite3, Past for iChat, SVG Shaper, Shrugs, HMScriptEditor. You don’t have to use it! ?

GitHub

View Github