Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use access modifiers for the Auth struct. #4

Open
OwenLaRosa opened this issue Nov 9, 2018 · 1 comment
Open

Use access modifiers for the Auth struct. #4

OwenLaRosa opened this issue Nov 9, 2018 · 1 comment
Labels
moviemanagerchallenge Task for "Improve the Movie Manager" Challenge

Comments

@OwenLaRosa
Copy link
Contributor

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 OwenLaRosa added the moviemanagerchallenge Task for "Improve the Movie Manager" Challenge label Nov 9, 2018
@Haibo-Zhou
Copy link

Well, I try on this.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
moviemanagerchallenge Task for "Improve the Movie Manager" Challenge
Projects
None yet
Development

No branches or pull requests

2 participants