This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// EventHandler.swift | |
// Unsplash | |
// | |
// Created by Olivier Collet on 2018-05-04. | |
// Copyright © 2018 Unsplash. All rights reserved. | |
// | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func unsplashPhotoPicker(_ photoPicker: UnsplashPhotoPicker, didSelectPhotos photos: [UnsplashPhoto]) { | |
// Do something with the photos | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let configuration = UnsplashPhotoPickerConfiguration( | |
accessKey: "<UNSPLASH_API_ACCESS_KEY>", | |
secretKey: "<UNSPLASH_API_SECRET_KEY>" | |
) | |
let photoPicker = UnsplashPhotoPicker(configuration: configuration) | |
photoPicker.photoPickerDelegate = self | |
present(photoPicker, animated: true, completion: nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct StoryboardIdentifier { | |
static let template = "Template" | |
} | |
struct ViewControllerIdentifier { | |
static let grid = "Grid" | |
static let gridNavigation = "GridNavigation" | |
static let item = "Item" | |
static let list = "List" | |
static let listNavigation = "ListNavigation" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private lazy var bundleResourceRequest = NSBundleResourceRequest(tags: Set(["Onboarding"])) | |
private func loadOnDemandAssets() { | |
bundleResourceRequest.conditionallyBeginAccessingResources { [unowned self] (available) in | |
if available { | |
self.loadOnboardingAssets() | |
} else { | |
self.bundleResourceRequest.beginAccessingResources { (error) in | |
guard error == nil else { return } | |
self.loadOnboardingAssets() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Declaration | |
struct ApplicationConfiguration { | |
let slideshowTimeInterval: TimeInterval = 15 | |
} | |
struct UnsplashConfiguration { | |
let applicationId = "********" | |
let secret = "********" | |
let apiURL = "https://api.unsplash.com/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface NSDate (TimeIntervalAddition) | |
- (NSString *)timeIntervalInWords; | |
@end |