Skip to content

Commit

Permalink
Northwind
Browse files Browse the repository at this point in the history
...
  • Loading branch information
helje5 committed Oct 14, 2023
1 parent 1be7a4e commit 478805a
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ Even just DocC documentation or more tests would be welcome contributions.
- [ManagedModels](https://github.com/Data-swift/ManagedModels/)
- [ManagedToDos.app](https://github.com/Data-swift/ManagedToDosApp)
- Blog article: [`@Model` for CoreData](https://www.alwaysrightinstitute.com/managedmodels/)
- [Northwind for ManagedModels](https://github.com/Northwind-swift/NorthwindManagedModels)
(more complex example, schema with many entities and a prefilled DB for
testing)
- Apple:
- [CoreData](https://developer.apple.com/documentation/coredata)
- [SwiftData](https://developer.apple.com/documentation/swiftdata)
Expand Down
47 changes: 47 additions & 0 deletions Sources/ManagedModels/Documentation.docc/Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,53 @@ struct ToDoListView: View {
- Example ToDo list app: [https://github.com/Data-swift/ManagedToDosApp.git](https://github.com/Data-swift/ManagedToDosApp/)


## Northwind

A little bigger example,
a port of a demo database for SwiftData to ManagedModels:
[Northwind for ManagedModels](https://github.com/Northwind-swift/NorthwindManagedModels)
(SwiftData original:
[NorthwindSwiftData](https://github.com/Northwind-swift/NorthwindSwiftData)).

This is the old [Northwind database](https://github.com/jpwhite3/northwind-SQLite3)
packaged up as a Swift package that works with ManagedModels.
It contains a set of model classes and a prefilled database which makes it ideal
for testing, to get started quickly.

Sample usage
(import `https://github.com/Northwind-swift/NorthwindSwiftData.git`):
```swift
import SwiftUI
import NorthwindSwiftData // @Northwind-swift/NorthwindManagedModels

@main
struct NorthwindApp: App {

var body: some Scene {
WindowGroup {
ContentView()
}
.modelContainer(try! NorthwindStore.modelContainer())
}
}

struct ContentView: View {

@FetchRequest(sort: \.name)
private var products: FetchedResults<Product>

var body: some View {
List {
ForEach(products) { product in
Text(verbatim: product.name)
}
}
}
}
```

- [Northwind for ManagedModels Documentation](https://swiftpackageindex.com/Northwind-swift/NorthwindManagedModels/documentation/northwindswiftdata)


## Topics

Expand Down
3 changes: 3 additions & 0 deletions Sources/ManagedModels/Documentation.docc/Links.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Swift Package URL: `https://github.com/Data-swift/ManagedModels.git`
- [ManagedModels](https://github.com/Data-swift/ManagedModels/)
- filing [GitHub Issues](https://github.com/Data-swift/ManagedModels/issues)
- [Managed ToDos](https://github.com/Data-swift/ManagedToDosApp/) example app
- [Northwind for ManagedModels](https://github.com/Northwind-swift/NorthwindManagedModels)
(more complex example, schema with many entities and a prefilled DB for
testing)


## Apple
Expand Down

0 comments on commit 478805a

Please sign in to comment.