ios-nd-networking
ios-nd-networking copied to clipboard
Use access modifiers for the Auth struct.
TMDBClient
has an Auth
struct that gets modified to store the request token and session ID. These values are only accessed from TMDBClient
, but they could be read or modified from another part of the app. This could potentially cause problems for debugging, as it's difficult to know which code modified the Auth values, but currently, there's no safeguard preventing someone from mistakenly modifying them outside of TMDBClient
.
To make the intent clearer, you can use Swift's access modifiers to restrict access to the Auth
struct, to only TMDBClient
.
Well, I try on this.
private static let apiKey = ""
struct Auth {
fileprivate static var accountId = 0
fileprivate static var requestToken = ""
fileprivate static var sessionId = ""
}