SHARE
TWEET

Untitled

a guest Sep 15th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class ObjectFactory {
  2.     static let shared = ObjectFactory()
  3.     private var websocketWrapper: WebsocketWrapper? = nil
  4.    
  5.     func provideWebsocketWrapper() -> WebsocketWrapper {
  6.         let validAuth = validatedAuth()
  7.         if websocketWrapper == nil {
  8.             websocketWrapper = WebsocketWrapper(token: validAuth?.token)
  9.         }
  10.         if let safeAuth = validAuth {
  11.             websocketWrapper?.authorize(with: safeAuth.token)
  12.         } else {
  13.             websocketWrapper?.revokeAuthorization()
  14.         }
  15.        
  16.         return websocketWrapper!
  17.     }
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top