Skip to content

Commit

Permalink
Refactor deprecated unarchiveTopLevelObjectWithData
Browse files Browse the repository at this point in the history
  • Loading branch information
heoblitz committed Mar 14, 2024
1 parent 81b6af7 commit f3de906
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit f3de906

Please sign in to comment.