Swiftpack.co - jlainog/unsplash-swift as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by jlainog.
jlainog/unsplash-swift 0.0.1
Unsplash Package
⭐️ 0
🕓 4 years ago
iOS
.package(url: "https://github.com/jlainog/unsplash-swift.git", from: "0.0.1")

unsplash-swift

Swift Package Manager GitHub license

Motivation

This Package borns as a way to create a SPM over an API and the lucky one is Unsplash 📷

Requirement

  • iOS 12+
  • XCode 11+

SwiftUI+Combine Example

Get Random Photo

Example App

Installation

SPM

.package(url: "https://github.com/jlainog/unsplash-swift", from: "0.0.1")

📷 Unsplash API

To access the Unsplash API you need to register and create an Application here Once you have an accessKey and secretKey configure the api using the line below.

Unsplash.configure(accessKey: String, secret: String)

🛠 DataTaskFactory

Each Method returns an URLSessionDataTask

DataTaskFactory.randomPhoto { (result) in
    switch result {
    case .success(let photo):
        dump(photo)
    default: break
    }
}.resume()

Currently the factory supports:

  • ☑ randomPhoto
  • ☑ searchPhotos
  • ☑ collection

📄 License

unsplash-swift is under MIT license.

GitHub

link
Stars: 0
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics