Skip to content

Instantly share code, notes, and snippets.

@koromiko
Created November 13, 2017 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koromiko/c619cbacb3d586e7dffe59277563cf20 to your computer and use it in GitHub Desktop.
Save koromiko/c619cbacb3d586e7dffe59277563cf20 to your computer and use it in GitHub Desktop.
class MockApiService: APIServiceProtocol {
var completePhotos: [Photo] = [Photo]() // Array of stubs
var completeClosure: ((Bool, [Photo], APIError?) -> ())
func fetchPopularPhoto(complete: @escaping (Bool, [Photo], APIError?) -> ()) {
\\...\\
completeClosure = complete
}
func fetchSuccess() {
completeClosure( true, completePhotos, nil ) // Return stubs instead of empty array
}
\\....\\
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment