For work with external databases, there are many packages available (Vapour, Fluent, Postgres etc.).
There are also excellent tutorials, showing how to use Vapor in SwiftUI/Core Data apps.
The upcoming SwiftData simplifies data binding and persistence management for internal and cloud storage. I haven't found documentation or a tutorial that shows how to use Vapor with an external database like Postgres in the context of SwiftData.
I am struggling connecting the dots between a SwiftUI/SwiftData app and a Vapor server with external database.
This is a Swift beginner question. Any guidance would be appreciated.
Thanks!
@0xTim : I plan to port a school management system from its current platform to Swift. Clients are on macOS. iOS clients may follow later.
Data cannot be stored in iCloud. This is why I am looking for a possibility to work with a database on a local server.
Haven't worked with SwiftData yet I am exploring my options. Couldn't find anything beyond on-device and iCloud storage for SwiftData but wasn't sure if I had fully understood all options.
With the information I got here it looks like a Vapor/Fluent server with a Postgres database is the way to go.
SwiftData would be for local storage and potentially iCloud. Sounds like you’ll need something else. If you’re familiar with CoreData, SwiftData sits on top of it.
Set up a Vapor server with Postgres, define endpoints, handle HTTP requests in SwiftUI/SwiftData app, and manage data serialization using Codable. You should consider security and error handling.