Apple just unveiled SwiftData, the all new framework for Apple Platforms, at WWDC 2023!
Here’s an iOS note taking application built to demonstrate various operations and persistance of data in SwiftData and SwiftUI!
I’ve tried to demonstrate CRUD operations using this app:
https://github.com/ishaanbedi/SDNotes/assets/39641326/b2c3f71a-d653-473e-914a-bc4e493d64a8
https://github.com/ishaanbedi/SDNotes/assets/39641326/9ba3f4a8-8365-419a-aa83-c3bdb65be775
https://github.com/ishaanbedi/SDNotes/assets/39641326/1fad4aa7-c3c6-48e5-b998-41ef98fadd34
@Model
class Note {
var title: String
var content: String
init(title: String, content: String) {
self.title = title
self.content = content
}
}
SDNotesApp.swift
file so as to extract context out of it in our views and controllers:```swift #8 import SwiftUI
@main struct SDNotesApp: App { var body: some Scene { WindowGroup { ContentView() .modelContainer(for: [Note.self]) } } }
```
developer.apple.com/documentation/SwiftData
I generated this super cool icon for this app in less than 10 seconds, oh boy, DALL-E is so good!