• Stars
    star
    390
  • Rank 110,242 (Top 3 %)
  • Language
    Swift
  • License
    MIT License
  • Created about 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ“ฑAn iOS photo picker to search and download photos from Unsplash.

Unsplash Photo Picker for iOS

CocoaPods Compatible SPM Compatible Carthage Compatible Platform License

UnsplashPhotoPicker is an iOS UI component that allows you to quickly search the Unsplash library for free high-quality photos with just a few lines of code.

Android photo picker here.

Unsplash Photo Picker for iOS preview

Table of Contents

Description

UnsplashPhotoPicker is a view controller. You present it to offer your users to select one or multiple photos from Unsplash. Once they have selected photos, the view controller returns UnsplashPhoto objects that you can use in your app.

Requirements

โš ๏ธ UnsplashPhotoPicker is not compatible with Objective-C.

Installation

Swift Package Manager

To integrate UnsplashPhotoPicker into your Xcode project using Swift Package Manager, open dependency manager through File > Swift Packages > Add Package Dependency....

and insert repository URL:

https://github.com/unsplash/unsplash-photopicker-ios.git

To add dependency in your own package, just specify it in dependencies of your Package.swift:

.package(
  name: "UnsplashPhotoPicker",
  url: "https://github.com/unsplash/unsplash-photopicker-ios.git",
  .upToNextMajor(from: "1.3.0")
)

Carthage

To integrate UnsplashPhotoPicker into your Xcode project using Carthage, specify it in your Cartfile:

github "unsplash/unsplash-photopicker-ios" ~> 1.3

Run carthage update to build the framework and drag the built UnsplashPhotoPicker.framework into your Xcode project.

CocoaPods

To integrate UnsplashPhotoPicker into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '12.1'
use_frameworks!

target '<Your Target Name>' do
    pod 'UnsplashPhotoPicker', '~> 1.3'
end

Then run pod install.

Git submodule

If you prefer not to use any of the aforementioned dependency managers, you can integrate UnsplashPhotoPicker into your project manually as a git submodule by running the following command in the project's folder:

$ git submodule add https://github.com/unsplash/unsplash-photopicker-ios.git

Drag the UnsplashPhotoPicker.xcodeproj file into your Xcode project, then drag the UnsplashPhotoPicker.framework to your target's "Embedded Binaries".

Usage

โ—๏ธBefore you get started, you need to register as a developer on our Developer portal. Once registered, create a new app to get an Access Key and a Secret Key.

Configuration

The UnsplashPhotoPicker is configured with an instance of UnsplashPhotoPickerConfiguration:

UnsplashPhotoPickerConfiguration(accessKey: String,
                                 secretKey: String,
                                 query: String,
                                 allowsMultipleSelection: Bool,
                                 memoryCapacity: Int,
                                 diskCapacity: Int)
Property Type Optional/Required Default
accessKey String Required N/A
secretKey String Required N/A
query String Optional nil
allowsMultipleSelection Bool Optional false
memoryCapacity Int Optional 50
diskCapacity Int Optional 100
contentFilterLevel ContentFilterLevel Optional .low

Presenting

UnsplashPhotoPicker is a subclass of UINavigationController. We recommend that you present it modally or as a popover on iPad. Before presenting it, you need to implement the UnsplashPhotoPickerDelegate protocol, and use the photoPickerDelegate property to get the results.

protocol UnsplashPhotoPickerDelegate: class {
  func unsplashPhotoPicker(_ photoPicker: UnsplashPhotoPicker, didSelectPhotos photos: [UnsplashPhoto])
  func unsplashPhotoPickerDidCancel(_ photoPicker: UnsplashPhotoPicker)
}

Using the results

UnsplashPhotoPicker returns an array of UnsplashPhoto objects. See UnsplashPhoto.swift for more details.

License

MIT License

Copyright (c) 2018-2022 Unsplash Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

react-trend

๐Ÿ“ˆ Simple, elegant spark lines
JavaScript
2,480
star
2

datasets

๐ŸŽ 4,800,000+ Unsplash images made available for research and machine learning
Jupyter Notebook
2,224
star
3

unsplash-js

๐Ÿค– Official JavaScript wrapper for the Unsplash API
TypeScript
2,027
star
4

unsplash-php

๐Ÿ‘ป Official PHP wrapper for the Unsplash API
PHP
408
star
5

unsplash-photopicker-android

๐Ÿ“ฑAn Android photo picker to search and download photos from Unsplash.
Kotlin
327
star
6

unsplash_rb

๐Ÿ’Ž Ruby wrapper for the Unsplash API.
Ruby
224
star
7

unsplash-source-js

๐Ÿฎ A javascript wrapper for the Unsplash Source API
JavaScript
176
star
8

comment-on-pr

A GitHub Action to comment on the relevant open PR when a commit is pushed.
Ruby
146
star
9

swiftui-lazycollectionview

A modest attempt to port UICollectionView to SwiftUI.
Swift
136
star
10

react-progressive-enhancement

A handy collection of HOCs for universally renderedย apps
TypeScript
63
star
11

intlc

Compile ICU messages into code. Supports TypeScript and JSX. No runtime.
Haskell
51
star
12

uploader-prototype

An open-source prototype of the Unsplash uploader.
TypeScript
45
star
13

sum-types

Safe, ergonomic, non-generic sum types in TypeScript.
TypeScript
41
star
14

url-transformers

Small helper library for manipulating URL strings in Node and in the browser.
TypeScript
35
star
15

ts-imgix

Strongly-typed imgix URL builder function, `buildImgixUrl`.
TypeScript
32
star
16

ts-namespace-import-plugin

Auto import common namespaces in your modules
TypeScript
30
star
17

pipe-ts

TypeScript
30
star
18

request-frp

`request-frp` is a package that provides pure wrappers around `fetch` and `XMLHttpRequest`.
TypeScript
14
star
19

ts-redux-finite-state-machine-example

TypeScript
13
star
20

tinplate

โญ๏ธ TinEye API wrapper
Ruby
13
star
21

responsive-image-test

TypeScript
12
star
22

unsplash-imageview-ios

A UIImageView subclass that displays a random photo from Unsplash.
Swift
9
star
23

imagga-auto-tag

๐ŸŽฉ Ruby client for fetching tags from the Imagga Auto Tagging API
Ruby
8
star
24

sum-types-fast-check

fast-check bindings for @unsplash/sum-types.
TypeScript
3
star
25

swift-storyboard-identifiers

A script that generates identifiers strings from .storyboard files.
Ruby
2
star
26

service-dash

๐Ÿ”ฅ Is anything on fire?
Ruby
2
star
27

mercury

The guide of souls to the underworld.
Rust
2
star
28

imgix-trackable

๐Ÿ›ฐ Tracklable Imgix URLs via the ixid param
TypeScript
2
star
29

sum-types-io-ts

io-ts bindings for @unsplash/sum-types.
TypeScript
2
star
30

ts-type-tests-example

TypeScript
2
star
31

import-sort-style-unsplash

TypeScript
2
star
32

sum-types-fp-ts

fp-ts bindings for @unsplash/sum-types.
TypeScript
2
star
33

translations-connector-test

1
star