Created
September 9, 2020 19:53
-
-
Save hrvolapeter/e9b2f2762996d07886a03d6f210a9f85 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension NoteDetailView { | |
class ViewModel: ObservableObject { | |
@Published var note: Note | |
init(note: Note) { | |
self.note = note | |
} | |
static func newNote() -> NoteDetailView.ViewModel { | |
self.newNote(parentId: nil) | |
} | |
static func newNote(parentId: String?) -> NoteDetailView.ViewModel { | |
NoteDetailView.ViewModel(note: .init(title: "", content: "", parentId: parentId, tags: [])) | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment