Created
June 15, 2015 08:41
-
-
Save clooth/fd3f7e9865978c6bfb09 to your computer and use it in GitHub Desktop.
This file contains 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
// Grab API instance | |
let API = APIClient.instance | |
// Attempt to authenticate with username and password | |
let Authentication = API.authenticate(username, password: password) | |
Authentication.onSuccess { user in | |
println("Logged in as \(user.userName!)!") | |
// Load user images after a successful sign-in | |
let UserImages = API.imagesForUserId(user.id!, nextToken: nil) | |
UserImages.onSuccess { images in | |
println("Loaded \(images.count) images for \(user.userName!).") | |
} | |
// In case of error | |
UserImages.onFailure { error in | |
println("Failed to load user images: \(error.localizedDescription)") | |
} | |
} | |
Authentication.onFailure { error in | |
println("Failed to authenticate user \(username): \(error.localizedDescription)") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment