Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
final class CheckMyGitHubIntentHandler: NSObject, CheckMyGitHubIntentHandling {
func handle(intent: CheckMyGitHubIntent, completion: @escaping (CheckMyGitHubIntentResponse) -> Void) {
guard let name = intent.name else {
completion(CheckMyGitHubIntentResponse(code: .failure, userActivity: nil))
return
}
Fetcher.fetch(name: name) { (user, followers) in
guard let user = user else {
completion(CheckMyGitHubIntentResponse(code: .failure, userActivity: nil))
return
}
completion(CheckMyGitHubIntentResponse.success(repos: user.repos as NSNumber, followers: followers.count as NSNumber))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.