UnsplashProvider - A package that can use the Unsplash API. It was developed as a SwiftUI

Overview

UnsplashProvider

It is a package that can use the Unsplash API. It was developed as a SwiftUI.

Platforms iOS macOS instagram SPM MIT

Screenshot

Usage

import UnsplashProvider
// You must enter the application access key.
UPConfiguration.shared.accessKey = "" // <YOUR_ACCESS_KEY>
  • How to use the built-in ObservableObject object

    @StateObject var photo = UPPhotoStore()
    @StateObject var photos = UPPhotosStore()
    @StateObject var randomPhotos = UPRandomPhotosStore()
    @StateObject var searchPhotos = UPSearchPhotosStore()
    @StateObject var searchUsers = UPSearchUsersStore()
    
    ...
    
    List(photos.photos) { photo in
        ...
    }
    List(randomPhotos.photos) { photo in
        ...
    }
    List(searchPhotos.photos) { photo in
        ...
    }
    List(searchUsers.users) { user in
        ...
    }
    
    ...
    
    // func fetchPhoto(id: String)
    photo.fetchPhoto(id: "F3OvjNcF5Xg") 
    
    // func fetchPhotos(page: Int = 1, perPage: Int = 30, orderBy: UPSort = .latest)
    photos.fetchPhotos(orderBy: .popular) 
    
    // func fetchPhotos(collections: String? = nil, topics: String? = nil, username: String? = nil, query: String? = nil, orientation: UPOrientation? = nil, contentFilter: UPContentFilter? = nil, count: Int = 1)
    randomPhotos.fetchPhotos(query: "cat", count: 30) 
    
    // func fetchSearchPhotos(query: String, page: Int = 1, perPage: Int = 30, orderBy: UPSort = .relevant, collections: String? = nil, contentFilter: UPContentFilter? = nil, color: UPColor? = nil, orientation: UPOrientation? = nil)
    searchPhotos.fetchSearchPhotos(query: "colorful", orientation: .squarish) 
    
    // func fetchSearchUsers(query: String, page: Int = 1, perPage: Int = 30)
    searchUsers.fetchSearchUsers(query: "lo") 
    
  • How to use Router directly.

    let router = UPAPIRouter.randomPhotos(query: "colorful", orientation: .landscape)
    UnsplashProvider().loadPhotos(router: router) { photos, error in
        guard error == nil else { return }
        if let photos = photos, !photos.isEmpty {
            let photo = photos[0]
            self.currentPhoto = photo
        }
    }

Dependencies

dependencies: [
    .package(url: "https://github.com/Alamofire/Alamofire.git", .branch("master"))
]

Contact

instagram : @dev.fabula
email : [email protected]

License

UnsplashProvider is available under the MIT license. See the LICENSE file for more info.

You might also like...
SwiftCANLib is a library used to process Controller Area Network (CAN) frames utilizing the Linux kernel open source library SOCKETCAN.

SwiftCANLib SwiftCANLib is a library used to process Controller Area Network (CAN) frames utilizing the Linux kernel open source library SOCKETCAN. Th

ServiceData is an HTTP networking library written in Swift which can download different types of data.

ServiceData Package Description : ServiceData is an HTTP networking library written in Swift which can download different types of data. Features List

Menet is a TCP network middleware that can be dynamically modified through HTTP requests.
Menet is a TCP network middleware that can be dynamically modified through HTTP requests.

Menet Menet is a TCP network middleware that can be dynamically modified through HTTP requests. This is an experimental project, do NOT use it in prod

Easy to use OAuth 2 library for iOS, written in Swift.
Easy to use OAuth 2 library for iOS, written in Swift.

Heimdallr Heimdallr is an OAuth 2.0 client specifically designed for easy usage. It currently supports the resource owner password credentials grant f

The easy way to use sockets on Apple platforms

SwiftSocket SwiftSocket library provides as easy to use interface for socket based connections on server or client side. Supports both TCP and UDP soc

WebSocket implementation for use by Client and Server

WebSocket ⚠️ This module contains no networking. To create a WebSocket Server, see WebSocketServer. To create a WebSocket Client, see WebSocketClient.

Easy to use SMJobBless, along with a full Swift implementation of the Authorization Services and Service Management frameworks

Leverage SMJobBless functionality with just one function call: let message = "Example App needs your permission to do thingamajig." let icon = Bundle.

Easy to use CFNetwork wrapper for HTTP requests, Objective-C, Mac OS X and iPhone

ASIHTTPRequest is an easy to use wrapper around the CFNetwork API that makes some of the more tedious aspects of communicating with web servers easier

Easy-to-use ICMP Ping for iOS (and maybe OSX)

CDZPinger Easy-to-use ICMP ping for iOS - just create a CDZPinger and you delegate gets a callback every second with the average ping time. Installati

Releases(0.5.0)
Owner
jasu
jasu
This package is meant to make http request of an easy way inspiren in the architecture of Moya package

NetworkAgent This package is meant to make http request of an easy way inspiren in the architecture of Moya package. This package is 100% free of depe

Angel Rada 19 Sep 8, 2022
NotionDrive - A swift package that can upload files to Notion.so or download files from Notion.so

NotionDrive NotionDrive is a swift package that can upload files to Notion.so or

Underthestars-zhy 4 Apr 9, 2022
Swift package for adding API Key requirement to vapor backends.

APIKeyMiddleware Swift package for adding API Key requirement to vapor backends. Features ✅ Supports an array of keys ✅ Supports overriding thrown err

null 2 Dec 9, 2021
ADVANCED APP DESIGN The main goal of this mini project is to inspire you on what we can accomplish with the SwiftUI framework.

Restart-App.0.2 ADVANCED APP DESIGN The main goal of this mini project is to inspire you on what we can accomplish with the SwiftUI framework. COMPLEX

Noye Samuel 1 Dec 11, 2021
Socket framework for Swift using the Swift Package Manager. Works on iOS, macOS, and Linux.

BlueSocket Socket framework for Swift using the Swift Package Manager. Works on iOS, macOS, and Linux. Prerequisites Swift Swift Open Source swift-5.1

Kitura 1.3k Dec 26, 2022
A Swift Package that allows iOS apps to communicate with AltServer.

AltKit allows apps to communicate with AltServers on the same WiFi network and enable features such as JIT compilation.

Riley Testut 45 Sep 8, 2022
This is my attempt to make this repo available on swift package manager

Parse LiveQuery Client for iOS/OSX PFQuery is one of the key concepts for Parse. It allows you to retrieve PFObjects by specifying some conditions, ma

Benji 0 Nov 3, 2021
UDPReader : a simple package for reading udp packets

UDPReader is a simple package for reading udp packets

leroy 2 Aug 7, 2022
Create xcframework zip archive for Swift binary package.

xczip xczip - create xcframework zip archive for swift binary package. Creates an xcframework archive with a stable checksum that does not change when

Dmitriy Borovikov 0 Jan 8, 2022
AsyncWebSocketClient - A package that contains a client behaving as a wrapper for the URLSessionWebSocketTask

(WORK IN PROGRESS) AsyncWebSocketClient This is a package that contains a client

null 3 Dec 30, 2022