Tusker/Tusker/LocalData.swift

71 lines
1.5 KiB
Swift
Raw Normal View History

2018-08-19 20:14:04 +00:00
//
// LocalData.swift
// Tusker
//
// Created by Shadowfacts on 8/18/18.
// Copyright © 2018 Shadowfacts. All rights reserved.
//
import Foundation
class LocalData {
static let shared = LocalData()
let defaults = UserDefaults()
2018-08-20 21:23:35 +00:00
private let onboardingCompleteKey = "onboardingComplete"
var onboardingComplete: Bool {
2018-08-19 20:14:04 +00:00
get {
2018-08-20 21:23:35 +00:00
return defaults.bool(forKey: onboardingCompleteKey)
2018-08-19 20:14:04 +00:00
}
set {
2018-08-20 21:23:35 +00:00
defaults.set(newValue, forKey: onboardingCompleteKey)
2018-08-19 20:14:04 +00:00
}
}
private let instanceURLKey = "instanceURL"
2018-09-11 14:52:21 +00:00
var instanceURL: URL? {
2018-08-19 20:14:04 +00:00
get {
2018-09-11 14:52:21 +00:00
return defaults.url(forKey: instanceURLKey)
2018-08-19 20:14:04 +00:00
}
set {
defaults.set(newValue, forKey: instanceURLKey)
}
}
private let clientIDKey = "clientID"
var clientID: String? {
get {
return defaults.string(forKey: clientIDKey)
}
set {
defaults.set(newValue, forKey: clientIDKey)
}
}
private let clientSecretKey = "clientSecret"
var clientSecret: String? {
get {
return defaults.string(forKey: clientSecretKey)
}
set {
defaults.set(newValue, forKey: clientSecretKey)
}
}
private let accessTokenKey = "accessToken"
var accessToken: String? {
get {
return defaults.string(forKey: accessTokenKey)
}
set {
defaults.set(newValue, forKey: accessTokenKey)
}
}
private init() {
}
}