|
1 | 1 | # Northwind-SQLite3.swift |
2 | 2 |
|
3 | | -2022-08-04: A fork of Northwind-SQLite3 which packages Northwind as a Swift |
4 | | - module. |
| 3 | +A fork of Northwind-SQLite3 which packages the Northwind |
| 4 | +database as a Swift module/package. |
| 5 | + |
| 6 | +Swift package documentation: |
| 7 | +[NorthwindSQLite.swift](https://lighter-swift.github.io/NorthwindSQLite.swift/documentation/northwind/). |
| 8 | + |
| 9 | +**Note**: |
| 10 | +Due to an Xcode 14 bug the Northwind module cannot yet be directly added to an |
| 11 | +Xcode project as a package dependency. |
| 12 | +A ["Local Package"](https://developer.apple.com/documentation/xcode/organizing-your-code-with-local-packages) |
| 13 | +needs to be setup. |
| 14 | +It works fine in regular SPM contexts. |
| 15 | + |
| 16 | +### Examples |
| 17 | + |
| 18 | +- [NorthwindWebAPI](https://github.com/Lighter-swift/Examples/blob/develop/Sources/NorthwindWebAPI/) (A server side Swift example |
| 19 | + exposing the DB as a JSON API endpoint, and providing a few pretty HTML |
| 20 | + pages showing data contained.) |
| 21 | +- [NorthwindSwiftUI](https://github.com/Lighter-swift/Examples/blob/develop/Sources/NorthwindSwiftUI/) (A SwiftUI example that lets |
| 22 | + one browse the Northwind database. Uses the Lighter API in combination with |
| 23 | + its async/await supports.) |
| 24 | + |
| 25 | +### Package.swift |
| 26 | + |
| 27 | +Example of a "LocalHelper" `Package.swift` that imports Northwind |
| 28 | +for Xcode use: |
| 29 | +```swift |
| 30 | +// swift-tools-version: 5.7 |
| 31 | +import PackageDescription |
| 32 | + |
| 33 | +let package = Package( |
| 34 | + name: "LocalHelper", |
| 35 | + platforms: [ .macOS(.v10_15), .iOS(.v13) ], // <= required |
| 36 | + products: [ |
| 37 | + .library( |
| 38 | + name: "LocalHelper", |
| 39 | + targets: ["LocalHelper"]), |
| 40 | + ], |
| 41 | + dependencies: [ |
| 42 | + .package(url: "https://github.com/Lighter-swift/NorthwindSQLite.swift.git", |
| 43 | + branch: "develop") |
| 44 | + ], |
| 45 | + targets: [ |
| 46 | + .target( |
| 47 | + name: "LocalHelper", |
| 48 | + dependencies: [ |
| 49 | + .product(name: "Northwind", package: "NorthwindSQLite.swift") |
| 50 | + ]) |
| 51 | + ] |
| 52 | +) |
| 53 | +``` |
| 54 | + |
| 55 | +To just re-export Northwind, use this in the LocalHelper.swift: |
| 56 | +```swift |
| 57 | +@_exported import Northwind |
| 58 | +``` |
| 59 | + |
5 | 60 |
|
6 | 61 | <hr /> |
7 | 62 |
|
|
0 commit comments