// // XCBSession.swift // Tusker // // Created by Shadowfacts on 9/23/18. // Copyright © 2018 Shadowfacts. All rights reserved. // import UIKit class XCBSession { let type: XCBSessionType let success: URL? let error: URL? let cancel: URL? init(type: XCBSessionType, success: URL?, error: URL?, cancel: URL?) { self.type = type self.success = success self.error = error self.cancel = cancel } func complete(with result: XCBSessionResult) { let url = result == .success ? success : result == .error ? error : cancel if let url = url { UIApplication.shared.open(url, options: [:]) } } } enum XCBSessionType { case postStatus } enum XCBSessionResult { case success, error, cancel }