frenzy-ios/Reader/LocalData+Migration.swift

24 lines
675 B
Swift
Raw Normal View History

//
// LocalData+Migration.swift
// Reader
//
// Created by Shadowfacts on 6/19/22.
//
import Foundation
import Persistence
extension LocalData {
static func migrateIfNecessary() {
if let accounts = UserDefaults.standard.object(forKey: "accounts") {
UserDefaults.standard.removeObject(forKey: "accounts")
defaults.set(accounts, forKey: "accounts")
}
if let mostRecentAccountID = UserDefaults.standard.object(forKey: "mostRecentAccountID") {
UserDefaults.standard.removeObject(forKey: "mostRecentAccountID")
defaults.set(mostRecentAccountID, forKey: "mostRecentAccountID")
}
}
}