Unsplash.swift
A lightweight Swift wrapper the Unsplash It API.
Installation
Swift Package Manager
Add "Unsplash.swift" to your Package.swift
file:
import PackageDescription
let package = Package(
name: "YourPackageName",
dependencies: [
.Package(url: "https://github.com/istx25/Unsplash.swift.git", majorVersion: 0),
]
)
Usage
Unsplash.randomImage(withSize: CGSize(width: 50.0, height: 50.0)) { (success, maybeImage) in
guard let image = maybeImage where success else {
return
}
dispatch_async(dispatch_get_main_queue()) {
self.someImageView?.image = image
}
}
License
Unsplash.swift is released under the MIT License.