Created
June 11, 2014 21:02
-
-
Save soffes/dd532d6f82050c46cb9d to your computer and use it in GitHub Desktop.
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
class APIClient { | |
} | |
var sharedAPIClient: APIClient = { | |
return APIClient() | |
}() | |
extension APIClient { | |
class func sharedClient() -> APIClient { | |
return sharedAPIClient | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What's the benefit of wrapping line 4 in a closure and then invoking it? Isn't this just running the code and initializing
APIClient
immediately?