Skip to content

Instantly share code, notes, and snippets.

@eMdOS
Created May 1, 2020 23:29
Show Gist options
  • Save eMdOS/92545ff34098dc3d33576252f842a118 to your computer and use it in GitHub Desktop.
Save eMdOS/92545ff34098dc3d33576252f842a118 to your computer and use it in GitHub Desktop.
Medium: Extending the Swift's Result type
let url: URL = "https://api.themoviedb.org/3/movie/now_playing?api_key=\(apiKey)&page=1"
URLSession.shared
.dataTaskPublisher(for: url)
.map(\.data)
.decode(type: MoviesPage.self, decoder: JSONDecoder())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment