forked from shadowfacts/Tusker
48 lines
1.1 KiB
Swift
48 lines
1.1 KiB
Swift
//
|
|
// NSUserActivity+Extensions.swift
|
|
// Tusker
|
|
//
|
|
// Created by Shadowfacts on 10/19/18.
|
|
// Copyright © 2018 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension NSUserActivity {
|
|
|
|
var displaysAuxiliaryScene: Bool {
|
|
get {
|
|
(userInfo?["displaysAuxiliaryScene"] as? Bool) ?? false
|
|
}
|
|
set {
|
|
if userInfo == nil {
|
|
userInfo = [:]
|
|
}
|
|
userInfo!["displaysAuxiliaryScene"] = newValue
|
|
}
|
|
}
|
|
|
|
var isStateRestorationActivity: Bool {
|
|
get {
|
|
(userInfo?["isStateRestorationActivity"] as? Bool) ?? false
|
|
}
|
|
set {
|
|
if userInfo == nil {
|
|
userInfo = [:]
|
|
}
|
|
userInfo!["isStateRestorationActivity"] = newValue
|
|
}
|
|
}
|
|
|
|
convenience init(type: UserActivityType) {
|
|
self.init(activityType: type.rawValue)
|
|
}
|
|
|
|
func handleResume(manager: UserActivityManager) -> Bool {
|
|
guard let type = UserActivityType(rawValue: activityType) else { return false }
|
|
type.handle(manager)(self)
|
|
return true
|
|
}
|
|
|
|
}
|