Skip to content

Commit b1f402a

Browse files
Example_02 and ordered to-many bugfix
1 parent 48d9afa commit b1f402a

26 files changed

Lines changed: 1283 additions & 20 deletions

Examples/Example_02/Example_02.xcodeproj/project.pbxproj

Lines changed: 478 additions & 0 deletions
Large diffs are not rendered by default.

Examples/Example_02/Example_02.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Created by Axel Ancona Esselmann on 5/6/24.
2+
//
3+
4+
import Foundation
5+
6+
@MainActor
7+
class AppInitializer: ObservableObject {
8+
9+
@Published
10+
var state: LoadableResult = .notStarted
11+
12+
@MainActor
13+
func initialize() async {
14+
guard case .notStarted = state else {
15+
return
16+
}
17+
state = .loading
18+
do {
19+
let container = try await ContainerBuilder.build()
20+
21+
AppState.shared = AppState(
22+
authorsManager: AuthorsManager(container: container),
23+
booksManager: BooksManager(container: container)
24+
)
25+
state = .success
26+
} catch {
27+
state = .failure(error)
28+
}
29+
}
30+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Created by Axel Ancona Esselmann on 5/6/24.
2+
//
3+
4+
import Foundation
5+
6+
struct AppState {
7+
8+
static var shared: AppState!
9+
10+
let authorsManager: AuthorsManager
11+
let booksManager: BooksManager
12+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Created by Axel Ancona Esselmann on 5/6/24.
2+
//
3+
4+
import SwiftUI
5+
6+
@main
7+
struct BooksApp: App {
8+
9+
@StateObject
10+
private var appInitializer = AppInitializer()
11+
12+
var body: some Scene {
13+
WindowGroup {
14+
switch appInitializer.state {
15+
case .notStarted, .loading:
16+
ProgressView()
17+
.task { await initialize() }
18+
case .success:
19+
ZStack {
20+
ContentView()
21+
}
22+
case .failure(let error):
23+
Text("App could not load: \(error.localizedDescription)")
24+
}
25+
}
26+
}
27+
28+
private func initialize() async {
29+
await appInitializer.initialize()
30+
}
31+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"colors" : [
3+
{
4+
"idiom" : "universal"
5+
}
6+
],
7+
"info" : {
8+
"author" : "xcode",
9+
"version" : 1
10+
}
11+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"platform" : "ios",
6+
"size" : "1024x1024"
7+
},
8+
{
9+
"idiom" : "mac",
10+
"scale" : "1x",
11+
"size" : "16x16"
12+
},
13+
{
14+
"idiom" : "mac",
15+
"scale" : "2x",
16+
"size" : "16x16"
17+
},
18+
{
19+
"idiom" : "mac",
20+
"scale" : "1x",
21+
"size" : "32x32"
22+
},
23+
{
24+
"idiom" : "mac",
25+
"scale" : "2x",
26+
"size" : "32x32"
27+
},
28+
{
29+
"idiom" : "mac",
30+
"scale" : "1x",
31+
"size" : "128x128"
32+
},
33+
{
34+
"idiom" : "mac",
35+
"scale" : "2x",
36+
"size" : "128x128"
37+
},
38+
{
39+
"idiom" : "mac",
40+
"scale" : "1x",
41+
"size" : "256x256"
42+
},
43+
{
44+
"idiom" : "mac",
45+
"scale" : "2x",
46+
"size" : "256x256"
47+
},
48+
{
49+
"idiom" : "mac",
50+
"scale" : "1x",
51+
"size" : "512x512"
52+
},
53+
{
54+
"idiom" : "mac",
55+
"scale" : "2x",
56+
"size" : "512x512"
57+
}
58+
],
59+
"info" : {
60+
"author" : "xcode",
61+
"version" : 1
62+
}
63+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.files.user-selected.read-only</key>
8+
<true/>
9+
</dict>
10+
</plist>

0 commit comments

Comments
 (0)