ios-nd-networking icon indicating copy to clipboard operation
ios-nd-networking copied to clipboard

Use access modifiers for the Auth struct.

Open OwenLaRosa opened this issue 6 years ago • 1 comments

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.

OwenLaRosa avatar Nov 09 '18 22:11 OwenLaRosa

Well, I try on this.

private static let apiKey = ""
    
    struct Auth {
        fileprivate static var accountId = 0
        fileprivate static var requestToken = ""
        fileprivate static var sessionId = ""
    }

Haibo-Zhou avatar Feb 05 '20 04:02 Haibo-Zhou