Skip to content

AlexandreBarbier/Unswash

Repository files navigation

BuddyBuild

Unswash

LightWeight library for Unsplash api

We provide a simple UI allowing to search and browse the free content of unsplash.

install: via cocoapods ->  pod 'Unswash'

Usage:

To use Unswash you need a developer account on Unsplash. To get your App Name and App ID you need to create an app on Unsplash

Once you have those informations you can start using Unswash.

Initialisation

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        Unswash.client.configure(clientId: "YOUR_APP_ID", clientName: "YOUR_APP_NAME")
        return true
}

Show Picker

After this step you can use the UI we created for you which look like this :

UnswashPhotoViewController.picker().present(in: self, quality: .regular) { image, url in
  DispatchQueue.main.async {
                
  }
}

Direct call to the API

Unswash.client.Photos.search(query: String, page: Int = 1, per_page: Int = 10, completion: @escaping ([Photo]) -> Void)

Unswash.client.Photos.get(page: Int = 1, per_page: Int = 10, order_by: Order = Order.latest, completion: @escaping ([Photo]) -> Void)