Skip to content

Instantly share code, notes, and snippets.

@artemnovichkov
Created July 8, 2018 13:22
Show Gist options
  • Save artemnovichkov/3958cac5d721f9079662e962f482b137 to your computer and use it in GitHub Desktop.
Save artemnovichkov/3958cac5d721f9079662e962f482b137 to your computer and use it in GitHub Desktop.
struct User {
let username: String
}
final class user Service {
static let shared = Service()
var user: User?
}
//getting a user from Firebase and save to the service
Service.shared.user = user
//inside any controller
if let user = Service.shared.user {
print(user.username)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment