ishaanbedi / SDNotes

iOS note taking application built to demonstrate various operations and persistance of data in SwiftData and SwiftUI!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SDNotes

Screenshot 2023-06-06 at 9 52 24 PM

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!

Working of the Application

I've tried to demonstrate CRUD operations using this app:

Creating a new note and Reading it:

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-06-06.at.21.12.32.mp4

Updating an existing note:

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-06-06.at.21.15.33.mp4

Deleting an existing note:

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-06-06.at.21.15.51.mp4

Model of a Note:

@Model
class Note {
    var title: String
    var content: String

    init(title: String, content: String) {
        self.title = title
        self.content = content
    }
}

Setting up this model as a model container in the SDNotesApp.swift file so as to extract context out of it in our views and controllers:

import SwiftUI

@main
struct SDNotesApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
                .modelContainer(for: [Note.self])
        }
    }
}

SwiftData docs:

developer.apple.com/documentation/SwiftData

License

MIT

PS: The Icon

icon
I generated this super cool icon for this app in less than 10 seconds, oh boy, DALL-E is so good!

About

iOS note taking application built to demonstrate various operations and persistance of data in SwiftData and SwiftUI!

License:MIT License


Languages

Language:Swift 100.0%