Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
NSCacheにデータを保存するにはどうすればよいSwift 3.0ですか?
NSCache
Swift 3.0
lazy var cache = NSCache<NSString, AnyObject>()
このような配列を作成しようとすると、次のエラーが発生します。
「タイプ 'Data' は 'AnyObject' に準拠していません」
ではSwift 2.0、次のコードが機能しました。
Swift 2.0
lazy var cache = NSCache()