Skip to content

Commit 493b31e

Browse files
committed
Merge branch 'develop'
2 parents ff1bcba + c6ca176 commit 493b31e

File tree

12 files changed

+60
-49
lines changed

12 files changed

+60
-49
lines changed

AppLogic/Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ let package = Package(
1515
// The dependencies.
1616
dependencies: [
1717
.package(url: "https://github.com/Lighter-swift/Lighter.git",
18-
from: "1.0.24"),
19-
.package(url: "https://github.com/Lighter-swift/NorthwindSQLite.swift.git",
20-
from: "1.0.10"),
18+
from: "1.0.32"),
19+
.package(url: "https://github.com/Northwind-swift/NorthwindSQLite.swift.git",
20+
from: "1.0.16"),
2121

2222
.package(url: "https://github.com/Macro-swift/MacroExpress.git",
2323
from: "1.0.2"),

LighterExamples.xcodeproj/project.pbxproj

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
E8224FE128A05CB900246A1F /* ProductsList.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8224FE028A05CB900246A1F /* ProductsList.swift */; };
2828
E86B87D728AD4DE400C5B588 /* Lighter in Frameworks */ = {isa = PBXBuildFile; productRef = E86B87D628AD4DE400C5B588 /* Lighter */; };
2929
E87B410D28A3C40500576D8A /* NavView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E87B410C28A3C40500576D8A /* NavView.swift */; };
30-
E87B411228A3C4B900576D8A /* NavVIewProductsList.swift in Sources */ = {isa = PBXBuildFile; fileRef = E87B411128A3C4B900576D8A /* NavVIewProductsList.swift */; };
30+
E87B411228A3C4B900576D8A /* NavViewProductsList.swift in Sources */ = {isa = PBXBuildFile; fileRef = E87B411128A3C4B900576D8A /* NavViewProductsList.swift */; };
3131
E87B411428A3C58500576D8A /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E87B411328A3C58500576D8A /* MainView.swift */; };
3232
E87B411628A3C7EB00576D8A /* Sidebar.swift in Sources */ = {isa = PBXBuildFile; fileRef = E87B411528A3C7EB00576D8A /* Sidebar.swift */; };
3333
E87B412328A3DC6500576D8A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E87B412228A3DC6500576D8A /* Assets.xcassets */; };
@@ -58,6 +58,7 @@
5858
E81B195A28A0782D003A0F1C /* SupplierForm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SupplierForm.swift; sourceTree = "<group>"; };
5959
E81B195C28A07836003A0F1C /* CategoryInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryInfo.swift; sourceTree = "<group>"; };
6060
E81B195E28A078B8003A0F1C /* Picture.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Picture.swift; sourceTree = "<group>"; };
61+
E81D692B28CCCA5D004F5E26 /* Lighter */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Lighter; path = ../Lighter; sourceTree = "<group>"; };
6162
E8224F9D28A0060F00246A1F /* AppLogic */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = AppLogic; sourceTree = "<group>"; };
6263
E8224FA328A0063A00246A1F /* NorthwindWebAPI */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = NorthwindWebAPI; sourceTree = BUILT_PRODUCTS_DIR; };
6364
E8224FAB28A0065C00246A1F /* Products.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Products.swift; sourceTree = "<group>"; };
@@ -75,24 +76,24 @@
7576
E8224FC928A0071100246A1F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
7677
E8224FCB28A0071100246A1F /* NorthwindSwiftUI.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NorthwindSwiftUI.entitlements; sourceTree = "<group>"; };
7778
E8224FCD28A0071100246A1F /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
78-
E8224FD328A0073000246A1F /* NorthwindApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NorthwindApp.swift; sourceTree = "<group>"; };
79+
E8224FD328A0073000246A1F /* NorthwindApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.swift; path = NorthwindApp.swift; sourceTree = "<group>"; };
7980
E8224FD428A0073000246A1F /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
8081
E8224FDB28A0557000246A1F /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
8182
E8224FDC28A0557000246A1F /* CONTRIBUTING.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CONTRIBUTING.md; sourceTree = "<group>"; };
8283
E8224FDD28A0557000246A1F /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
8384
E8224FE028A05CB900246A1F /* ProductsList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductsList.swift; sourceTree = "<group>"; };
8485
E86867D428A3F43300117E0E /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
8586
E87B410C28A3C40500576D8A /* NavView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavView.swift; sourceTree = "<group>"; };
86-
E87B411128A3C4B900576D8A /* NavVIewProductsList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavVIewProductsList.swift; sourceTree = "<group>"; };
87+
E87B411128A3C4B900576D8A /* NavViewProductsList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavViewProductsList.swift; sourceTree = "<group>"; };
8788
E87B411328A3C58500576D8A /* MainView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = "<group>"; };
8889
E87B411528A3C7EB00576D8A /* Sidebar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar.swift; sourceTree = "<group>"; };
8990
E87B411728A3CF9D00576D8A /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
9091
E87B411C28A3DC6500576D8A /* Bodies.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Bodies.app; sourceTree = BUILT_PRODUCTS_DIR; };
9192
E87B412228A3DC6500576D8A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
9293
E87B412428A3DC6500576D8A /* Bodies.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Bodies.entitlements; sourceTree = "<group>"; };
9394
E87B412628A3DC6500576D8A /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
94-
E87B412C28A3DCAD00576D8A /* BodiesApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BodiesApp.swift; sourceTree = "<group>"; };
95-
E87B412D28A3DCAD00576D8A /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
95+
E87B412C28A3DCAD00576D8A /* BodiesApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = BodiesApp.swift; sourceTree = "<group>"; };
96+
E87B412D28A3DCAD00576D8A /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
9697
E87D45FE28A3C341008E04EA /* NavViewMain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavViewMain.swift; sourceTree = "<group>"; };
9798
E8AF70C928A3DDE9008444B2 /* BodiesDB-001.sql */ = {isa = PBXFileReference; lastKnownFileType = text; path = "BodiesDB-001.sql"; sourceTree = "<group>"; };
9899
/* End PBXFileReference section */
@@ -128,6 +129,7 @@
128129
E8224F8228A005CF00246A1F = {
129130
isa = PBXGroup;
130131
children = (
132+
E81D692B28CCCA5D004F5E26 /* Lighter */,
131133
E8224FDB28A0557000246A1F /* README.md */,
132134
E8224FDD28A0557000246A1F /* LICENSE */,
133135
E8224FDC28A0557000246A1F /* CONTRIBUTING.md */,
@@ -138,7 +140,7 @@
138140
E8224F8C28A005CF00246A1F /* Products */,
139141
E8224FBC28A0066800246A1F /* Frameworks */,
140142
);
141-
indentWidth = 4;
143+
indentWidth = 2;
142144
sourceTree = "<group>";
143145
};
144146
E8224F8C28A005CF00246A1F /* Products */ = {
@@ -271,7 +273,7 @@
271273
E87B410C28A3C40500576D8A /* NavView.swift */,
272274
E87D45FE28A3C341008E04EA /* NavViewMain.swift */,
273275
E81B195228A065A6003A0F1C /* NavViewSidebar.swift */,
274-
E87B411128A3C4B900576D8A /* NavVIewProductsList.swift */,
276+
E87B411128A3C4B900576D8A /* NavViewProductsList.swift */,
275277
);
276278
path = NavigationViewBasedUI;
277279
sourceTree = "<group>";
@@ -432,7 +434,7 @@
432434
E87B411428A3C58500576D8A /* MainView.swift in Sources */,
433435
E81B195728A07563003A0F1C /* ProductForm.swift in Sources */,
434436
E87D45FF28A3C341008E04EA /* NavViewMain.swift in Sources */,
435-
E87B411228A3C4B900576D8A /* NavVIewProductsList.swift in Sources */,
437+
E87B411228A3C4B900576D8A /* NavViewProductsList.swift in Sources */,
436438
E8224FE128A05CB900246A1F /* ProductsList.swift in Sources */,
437439
E81B195128A06525003A0F1C /* ProductCell.swift in Sources */,
438440
E81B195928A0769D003A0F1C /* Ambiguities.swift in Sources */,
@@ -809,7 +811,7 @@
809811
repositoryURL = "https://github.com/Lighter-swift/Lighter.git";
810812
requirement = {
811813
kind = upToNextMajorVersion;
812-
minimumVersion = 1.0.24;
814+
minimumVersion = 1.0.32;
813815
};
814816
};
815817
E8AF70C028A3DD80008444B2 /* XCRemoteSwiftPackageReference "Lighter" */ = {

Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ var package = Package(
1111
],
1212

1313
dependencies: [
14-
.package(url: "https://github.com/Lighter-swift/Lighter.git", from: "1.0.24"),
15-
.package(url: "https://github.com/Lighter-swift/NorthwindSQLite.swift.git",
16-
from: "1.0.10"),
14+
.package(url: "https://github.com/Lighter-swift/Lighter.git", from: "1.0.30"),
15+
.package(url: "https://github.com/Northwind-swift/NorthwindSQLite.swift.git",
16+
from: "1.0.14"),
1717

1818
.package(url: "https://github.com/Macro-swift/MacroExpress.git",
1919
from: "1.0.2"),

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Examples for the Lighter SQLite environment, SwiftUI and server side.
88
Note: The examples require Swift 5.7 / Xcode 14b for proper plugin support.
99

1010
When embedding a package using Enlighter (like
11-
[NorthwindSQLite.swift](https://github.com/Lighter-swift/NorthwindSQLite.swift.git)),
11+
[NorthwindSQLite.swift](https://github.com/Northwind-swift/NorthwindSQLite.swift.git)),
1212
[a local package](https://developer.apple.com/documentation/xcode/organizing-your-code-with-local-packages)
1313
seems to be required w/ the Xcode 14 beta (3...5).
1414
Otherwise the Swift package plugins do not seem to run.
@@ -22,7 +22,7 @@ help.
2222
The Northwind database is a common database example that has been ported
2323
to SQLite.
2424
Lighter provides a Swift version of that in the
25-
[NorthwindSQLite.swift](https://github.com/Lighter-swift/NorthwindSQLite.swift)
25+
[NorthwindSQLite.swift](https://github.com/Northwind-swift/NorthwindSQLite.swift)
2626
repository.
2727

2828
> Note: The particular SQLite version of the Northwind database is quite
@@ -31,7 +31,7 @@ repository.
3131
> That actually makes it a good example on how to deal with such databases in
3232
> Lighter.
3333
34-
The Swift Northwind API: [Documentation](https://Lighter-swift.github.io/NorthwindSQLite.swift/documentation/northwind/).
34+
The Swift Northwind API: [Documentation](https://Northwind-swift.github.io/NorthwindSQLite.swift/documentation/northwind/).
3535

3636

3737
### Examples

Sources/NorthwindSwiftUI/MainView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ struct MainView: View {
4545
case .products:
4646
ProductsList(products: $products,
4747
selectedProduct: $selectedProductID)
48+
#if os(macOS)
49+
.frame(minWidth: 274) // otherwise overlaps on macOS 13
50+
#endif
4851

4952
case .none:
5053
Text("No section is selected")

Sources/NorthwindSwiftUI/NorthwindApp.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import SwiftUI
22
import Northwind
33
import Lighter
4+
import SQLite3
45

56
/// Global application state. A good place to setup the database object.
67
@main
@@ -9,6 +10,7 @@ struct NorthwindApp: App {
910
let database = (try? Northwind.bootstrap(
1011
copying: Northwind.module.connectionHandler.url
1112
)) ?? .module!
13+
1214

1315
var body: some Scene {
1416
WindowGroup {

Sources/NorthwindSwiftUI/ProductCell.swift

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,32 @@ struct ProductCell: View {
1818
VStack(alignment: .leading) {
1919
Text(verbatim: product.productName)
2020
.font(.headline)
21-
22-
HStack(spacing: 0) {
23-
Text(product.unitPrice ?? 0, format: .currency(code: "USD"))
24-
if unitsInStock > 0 {
25-
Text(", \(unitsInStock) in stock")
26-
}
27-
else if product.discontinued != "0" {
28-
Text(", ") +
29-
Text("discontinued").foregroundColor(.red)
30-
}
31-
else {
32-
Text(", ") +
33-
Text("out of stock.").foregroundColor(.red)
34-
if let ordered = product.unitsOnOrder, ordered > 0 {
35-
Text(", ordered \(ordered)")
36-
}
37-
}
38-
}
39-
40-
if unitsInStock > 0 && product.discontinued != "0" {
41-
Text("Discontinued")
42-
.foregroundColor(.red)
43-
}
21+
22+
detailText
4423
}
4524
},
4625
icon: { Image(systemName: "p.circle") }
4726
)
4827
}
28+
29+
var detailText : Text {
30+
var text = Text(product.unitPrice ?? 0, format: .currency(code: "USD"))
31+
32+
if unitsInStock > 0 {
33+
text = text + Text(", \(unitsInStock) in stock")
34+
}
35+
else {
36+
text = text + Text(", ")
37+
text = text + Text("out of stock").foregroundColor(.red)
38+
if let ordered = product.unitsOnOrder, ordered > 0 {
39+
text = text + Text(", ordered \(ordered)")
40+
}
41+
}
42+
43+
if product.discontinued != "0" {
44+
text = text + Text(", ")
45+
text = text + Text("discontinued").foregroundColor(.red)
46+
}
47+
return text
48+
}
4949
}

Sources/NorthwindSwiftUI/ProductsList.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,17 @@ struct ProductsList: View {
3737
)
3838
}
3939

40-
#if !os(macOS)
41-
if horizontalSizeClass != .compact {
42-
// Pre-select the first match if none is selected
40+
// Pre-select the first match if none is selected.
41+
#if os(macOS)
4342
if selectedProduct == nil, let product = products.first {
4443
selectedProduct = product.id
4544
}
46-
}
45+
#else
46+
if horizontalSizeClass != .compact { // this waits for the tap
47+
if selectedProduct == nil, let product = products.first {
48+
selectedProduct = product.id
49+
}
50+
}
4751
#endif
4852
}
4953
catch { // really, do proper error handling :-)

Sources/NorthwindSwiftUI/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ but keeps everything in local states.
1414

1515
Note: The example requires Swift 5.7 / Xcode 14b for proper plugin support.
1616

17-
Northwind API: [Documentation](https://55db091a-8471-447b-8f50-5dff4c1b14ac.github.io/NorthwindSQLite.swift/documentation/northwind/)
17+
Northwind API: [Documentation](https://Northwind-sqlite.github.io/NorthwindSQLite.swift/documentation/northwind/)
1818

1919

2020

Sources/NorthwindSwiftUI/Sidebar.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import SwiftUI
22
import Northwind
33

44
@available(iOS 16.0, macOS 13, *)
5-
extension MainView: View {
5+
extension MainView {
66

77
struct Sidebar: View {
88

0 commit comments

Comments
 (0)