Tusker/Tusker/Extensions/UISceneSession+MastodonCont...

33 lines
800 B
Swift
Raw Normal View History

//
// UISceneSession+MastodonController.swift
// Tusker
//
// Created by Shadowfacts on 1/7/20.
// Copyright © 2020 Shadowfacts. All rights reserved.
//
import UIKit
extension UISceneSession {
var mastodonController: MastodonController? {
get {
return userInfo?["mastodonController"] as? MastodonController
}
set {
if let newValue = newValue {
if userInfo == nil {
userInfo = ["mastodonController": newValue]
} else {
userInfo!["mastodonController"] = newValue
}
} else {
if userInfo != nil {
userInfo?.removeValue(forKey: "mastodonController")
}
}
}
}
}