File tree 6 files changed +59
-3
lines changed
6 files changed +59
-3
lines changed Original file line number Diff line number Diff line change 11
11
- name : Select latest available Xcode
12
12
uses : maxim-lobanov/setup-xcode@v1
13
13
with :
14
- xcode-version : ' 15.0 .0'
14
+ xcode-version : ' 15.2 .0'
15
15
- name : Checkout Repository
16
16
uses : actions/checkout@v2
17
17
- name : Build Swift Debug Package
Original file line number Diff line number Diff line change 3
3
align="right" width="64" height="64" />
4
4
</h2 >
5
5
6
+ ** 2024-01-19** : Seems to be b0rked w/ Xcode 15.2: Issue https://github.com/Data-swift/ManagedModels/issues/25
7
+
6
8
> Instead of wrapping CoreData, use it directly :-)
7
9
8
10
The key thing ** ManagedModels** provides is a ` @Model ` macro,
@@ -160,6 +162,9 @@ Even just DocC documentation or more tests would be welcome contributions.
160
162
- [ ManagedModels] ( https://github.com/Data-swift/ManagedModels/ )
161
163
- [ ManagedToDos.app] ( https://github.com/Data-swift/ManagedToDosApp )
162
164
- Blog article: [ ` @Model ` for CoreData] ( https://www.alwaysrightinstitute.com/managedmodels/ )
165
+ - [ Northwind for ManagedModels] ( https://github.com/Northwind-swift/NorthwindManagedModels )
166
+ (more complex example, schema with many entities and a prefilled DB for
167
+ testing)
163
168
- Apple:
164
169
- [ CoreData] ( https://developer.apple.com/documentation/coredata )
165
170
- [ SwiftData] ( https://developer.apple.com/documentation/swiftdata )
Original file line number Diff line number Diff line change @@ -54,6 +54,53 @@ struct ToDoListView: View {
54
54
- Example ToDo list app: [ https://github.com/Data-swift/ManagedToDosApp.git ] ( https://github.com/Data-swift/ManagedToDosApp/ )
55
55
56
56
57
+ ## Northwind
58
+
59
+ A little bigger example,
60
+ a port of a demo database for SwiftData to ManagedModels:
61
+ [ Northwind for ManagedModels] ( https://github.com/Northwind-swift/NorthwindManagedModels )
62
+ (SwiftData original:
63
+ [ NorthwindSwiftData] ( https://github.com/Northwind-swift/NorthwindSwiftData ) ).
64
+
65
+ This is the old [ Northwind database] ( https://github.com/jpwhite3/northwind-SQLite3 )
66
+ packaged up as a Swift package that works with ManagedModels.
67
+ It contains a set of model classes and a prefilled database which makes it ideal
68
+ for testing, to get started quickly.
69
+
70
+ Sample usage
71
+ (import ` https://github.com/Northwind-swift/NorthwindSwiftData.git ` ):
72
+ ``` swift
73
+ import SwiftUI
74
+ import NorthwindSwiftData // @Northwind-swift/NorthwindManagedModels
75
+
76
+ @main
77
+ struct NorthwindApp : App {
78
+
79
+ var body: some Scene {
80
+ WindowGroup {
81
+ ContentView ()
82
+ }
83
+ .modelContainer (try ! NorthwindStore.modelContainer ())
84
+ }
85
+ }
86
+
87
+ struct ContentView : View {
88
+
89
+ @FetchRequest (sort: \.name )
90
+ private var products: FetchedResults<Product>
91
+
92
+ var body: some View {
93
+ List {
94
+ ForEach (products) { product in
95
+ Text (verbatim : product.name )
96
+ }
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ - [ Northwind for ManagedModels Documentation] ( https://swiftpackageindex.com/Northwind-swift/NorthwindManagedModels/documentation/northwindswiftdata )
103
+
57
104
58
105
## Topics
59
106
Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ It is a conversion of the Xcode template project for CoreData.
22
22
and press "Add Package" twice.
23
23
24
24
> At some point Xcode will stop compilation and ask you to confirm that you
25
- > want to use the ` @Model ` macro provided by ManagedModels.
25
+ > want to use the ` @Model ` macro provided by ManagedModels
26
+ > ("Target 'ManagedModelMacros' must be enabled before it can be used.").
26
27
> Confirm to continue, or review the source code of the macro first.
27
28
28
29
Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ Swift Package URL: `https://github.com/Data-swift/ManagedModels.git`
10
10
- [ ManagedModels] ( https://github.com/Data-swift/ManagedModels/ )
11
11
- filing [ GitHub Issues] ( https://github.com/Data-swift/ManagedModels/issues )
12
12
- [ Managed ToDos] ( https://github.com/Data-swift/ManagedToDosApp/ ) example app
13
+ - [ Northwind for ManagedModels] ( https://github.com/Northwind-swift/NorthwindManagedModels )
14
+ (more complex example, schema with many entities and a prefilled DB for
15
+ testing)
13
16
14
17
15
18
## Apple
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ public macro Transient() =
63
63
* An internal helper macro. Don't use this.
64
64
*/
65
65
@available ( swift 5 . 9 )
66
- @attached ( accessor, names : named ( init ) )
66
+ @attached ( accessor)
67
67
public macro _PersistedProperty( ) =
68
68
#externalMacro( module: " ManagedModelMacros " , type: " PersistedPropertyMacro " )
69
69
You can’t perform that action at this time.
0 commit comments