Skip to content

Commit cc4ba2b

Browse files
committed
Merge branch 'develop'
2 parents 2955475 + 4162d58 commit cc4ba2b

File tree

6 files changed

+59
-3
lines changed

6 files changed

+59
-3
lines changed

.github/workflows/swift.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- name: Select latest available Xcode
1212
uses: maxim-lobanov/setup-xcode@v1
1313
with:
14-
xcode-version: '15.0.0'
14+
xcode-version: '15.2.0'
1515
- name: Checkout Repository
1616
uses: actions/checkout@v2
1717
- name: Build Swift Debug Package

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
align="right" width="64" height="64" />
44
</h2>
55

6+
**2024-01-19**: Seems to be b0rked w/ Xcode 15.2: Issue https://github.com/Data-swift/ManagedModels/issues/25
7+
68
> Instead of wrapping CoreData, use it directly :-)
79
810
The key thing **ManagedModels** provides is a `@Model` macro,
@@ -160,6 +162,9 @@ Even just DocC documentation or more tests would be welcome contributions.
160162
- [ManagedModels](https://github.com/Data-swift/ManagedModels/)
161163
- [ManagedToDos.app](https://github.com/Data-swift/ManagedToDosApp)
162164
- 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)
163168
- Apple:
164169
- [CoreData](https://developer.apple.com/documentation/coredata)
165170
- [SwiftData](https://developer.apple.com/documentation/swiftdata)

Sources/ManagedModels/Documentation.docc/Documentation.md

+47
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,53 @@ struct ToDoListView: View {
5454
- Example ToDo list app: [https://github.com/Data-swift/ManagedToDosApp.git](https://github.com/Data-swift/ManagedToDosApp/)
5555

5656

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+
57104

58105
## Topics
59106

Sources/ManagedModels/Documentation.docc/GettingStarted.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ It is a conversion of the Xcode template project for CoreData.
2222
and press "Add Package" twice.
2323

2424
> 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.").
2627
> Confirm to continue, or review the source code of the macro first.
2728
2829

Sources/ManagedModels/Documentation.docc/Links.md

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Swift Package URL: `https://github.com/Data-swift/ManagedModels.git`
1010
- [ManagedModels](https://github.com/Data-swift/ManagedModels/)
1111
- filing [GitHub Issues](https://github.com/Data-swift/ManagedModels/issues)
1212
- [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)
1316

1417

1518
## Apple

Sources/ManagedModels/ModelMacroDefinition.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public macro Transient() =
6363
* An internal helper macro. Don't use this.
6464
*/
6565
@available(swift 5.9)
66-
@attached(accessor, names: named(init))
66+
@attached(accessor)
6767
public macro _PersistedProperty() =
6868
#externalMacro(module: "ManagedModelMacros", type: "PersistedPropertyMacro")
6969

0 commit comments

Comments
 (0)