Skip to content

Commit f202c22

Browse files
Initial commit of Example_01
1 parent 96d8a34 commit f202c22

19 files changed

Lines changed: 900 additions & 0 deletions

File tree

Examples/Example_01/Example_01.xcodeproj/project.pbxproj

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

Examples/Example_01/Example_01.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: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Created by Axel Ancona Esselmann on 5/6/24.
2+
//
3+
4+
import Foundation
5+
import CoreData
6+
7+
@MainActor
8+
class AppInitializer: ObservableObject {
9+
10+
@Published
11+
var state: LoadableResult = .notStarted
12+
13+
@MainActor
14+
func initialize() async {
15+
guard case .notStarted = state else {
16+
return
17+
}
18+
state = .loading
19+
do {
20+
let container = try await ContainerBuilder.build()
21+
22+
let notesManager = NotesManager(container: container)
23+
24+
AppState.shared = AppState(
25+
notesManager: notesManager
26+
)
27+
state = .success
28+
} catch {
29+
state = .failure(error)
30+
}
31+
}
32+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Created by Axel Ancona Esselmann on 5/6/24.
2+
//
3+
4+
import Foundation
5+
6+
struct AppState {
7+
static var shared: AppState!
8+
9+
let notesManager: NotesManager
10+
}
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 NotesApp: 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+
NotesView()
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)