Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Foundation
- class RNAsyncStorage {
- private static let RCTStorageDirectory = "RCTAsyncLocalStorage_V1"
- private static let RCTManifestFileName = "manifest.json"
- private static func getStorageDirectory() -> URL? {
- return FileManager.default
- .urls(
- for: .documentDirectory,
- in: .userDomainMask
- )
- .first?
- .appendingPathComponent(RCTStorageDirectory)
- }
- private static func getManifestFilePath() -> URL? {
- return getStorageDirectory()?.appendingPathComponent(RCTManifestFileName)
- }
- static func getString() -> String? {
- guard
- let manifestFilePath = getManifestFilePath(),
- let result = try? String(contentsOf: manifestFilePath, encoding: .utf8)
- else {
- return nil
- }
- return result
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement