Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor deprecated unarchiveTopLevelObjectWithData #70

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Refactor deprecated unarchiveTopLevelObjectWithData
  • Loading branch information
heoblitz committed Mar 14, 2024
commit f3de906c42859c67fad60fe3fcf204a3dd5c7974
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ final class MetaDataCache<Cache: AsyncKeyValueCaching>: AsyncKeyValueCaching whe

func getEntity(for url: URL) throws -> LPLinkMetadata {
let data = try cache.getEntity(for: url)
// swiftlint:disable force_try force_cast
let entity = try! NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as! LPLinkMetadata
// swiftlint:enable force_try force_cast
guard let entity = try NSKeyedUnarchiver.unarchivedObject(ofClass: LPLinkMetadata.self, from: data) else {
throw CacheError.invalidData
}
return entity
}

Expand Down