Read and decrypt Apple Notes databases from Swift.
import NotesKit
let library = try NotesLibrary()
for note in try library.notes {
let markdown = try note.markdown()
print(markdown)
}let markdown = try note.markdown(password: "secret")Or with the visitor API:
try note.parse(visitor: myVisitor, password: "secret")Implement NoteVisitor to process note content:
class MyVisitor: NoteVisitor {
func visitParagraph(_ paragraph: Paragraph) { ... }
func visitListItem(_ item: ListItem) { ... }
func visitAttachment(_ attachment: NoteAttachment) { ... }
}A built-in MarkdownVisitor converts notes to Markdown.
let folders = try library.folders
let accounts = try library.accounts| Format | Versions | Status |
|---|---|---|
| V1 | iOS 16 and earlier | Supported |
| V1 Neo | macOS 15+ | Supported |
| V2 (Keychain) | macOS 15+ | Not supportable |
V2 notes are encrypted with a key stored in the system Keychain, not derivable from a password. See docs/encryption-research.md for details.
- Swift 6.2+
- macOS 13+ / iOS 16+
Add to your Package.swift:
dependencies: [
.package(url: "https://github.com/6over3/noteskit", from: "1.0.0"),
]GNU Affero General Public License v3.0. See LICENSE.