Created
August 4, 2020 10:45
-
-
Save yimajo/d3c8f6b91261c1282b3eef77c8aeab15 to your computer and use it in GitHub Desktop.
An idea to add an AccessToken to EnvironmentValues in the SwiftUI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
extension EnvironmentValues { | |
struct AccessTokenKey: EnvironmentKey { | |
static var defaultValue: String? { | |
nil | |
} | |
} | |
var accessToken: String? { | |
get { | |
self[AccessTokenKey.self] | |
} | |
set { | |
self[AccessTokenKey.self] = newValue | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment