jlainog / unsplash-swift

Unsplash Package

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

.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.

About

Unsplash Package

License:MIT License


Languages

Language:Swift 98.9%Language:Objective-C 1.1%