If the bookmarks are never saved before you should not force unwrap them.
I fixed it like this.
func loadBookmarks()
{
let path = getBookmarkPath()
let bookmarksTemp = NSKeyedUnarchiver.unarchiveObject(withFile: path) as? [URL: Data]
if bookmarksTemp != nil {
bookmarks = bookmarksTemp!
for bookmark in bookmarks
{
restoreBookmark(bookmark)
}
}
}
If the bookmarks are never saved before you should not force unwrap them.
I fixed it like this.
func loadBookmarks()
{
let path = getBookmarkPath()
}