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
extension PHAsset { | |
// MARK: This returns an array of alternate assets from a PHAsset | |
func getAlternatePhotos() -> [PHAsset] { | |
/// get the collection of the asset to avoid fetching all photos in the library | |
let collectionFetchResult = PHAssetCollection.fetchAssetCollectionsContaining(self, with: .moment, options: nil) | |
let options = PHFetchOptions() | |
options.sortDescriptors = [NSSortDescriptor.init(key: "creationDate", ascending: true)] |
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
extension KairosAPI { | |
/* | |
Takes a photo and returns the facial features it finds.To detect faces, all you need to do is submit a JPG or PNG photo. You can submit the photo either as a publicly accessible URL or Base64 encoded.Finally, we have some advanced options available for your use. We have set these options to sensible defaults, but sometimes there is a need to override them and we have provided that facility for you.One additional thing to note is that the returned coordinates all begin at the top left of the photo. | |
*/ | |
typealias CompletionHandler = (Response<String>) -> Void | |
func detect(_ image: UIImage, completion: @escaping CompletionHandler ) { | |
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 KairosConfig { | |
/// HERE GOES YOUR KEY AND ID | |
static let app_id = "" | |
static let app_key = "" | |
} | |
public class KairosAPI { | |
let api_url: String = "https://api.kairos.com/" | |
let app_id: String |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
var str = "Hello, playground" | |
// Big O notation linear vs constant |
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
//: Playground - noun: a place where people can play | |
struct Person { | |
let firstName: String | |
let lastName: String | |
let age: Int | |
} | |
let people = [ | |
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
SwiftLint defintion | |
Linting is the process of running a program that will analyse code for potential errors. | |
Lint as a term can also refer more broadly to syntactic discrepancies in general, especially in interpreted languages like JavaScript and Python. For example, modern lint checkers are often used to find code that does not correspond to certain style guidelines. | |
Wikipedia link | |
https://en.wikipedia.org/wiki/Lint_%28software%29 | |
SWiftLint what is it? |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
//ENUMS | |
enum Day { | |
case monday |
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
{ | |
results: [ | |
{ | |
vote_count: 2291, | |
id: 284053, | |
video: false, | |
vote_average: 7.5, | |
title: "Thor: Ragnarok", | |
popularity: 676.992626, | |
poster_path: "/oSLd5GYGsiGgzDPKTwQh7wamO8t.jpg", |
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
// | |
// KMCardImagetray.swift | |
// KodakMoments | |
// | |
// Created by james rochabrun on 9/26/17. | |
// Copyright © 2017 Kodak Alaris Inc. All rights reserved. | |
// | |
import Foundation | |
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
protocol StringSubscriptable { | |
} | |
extension StringSubscriptable where Self: Character { | |
subscript (i: Int) -> Character { | |
return self[index(startIndex, offsetBy: i)] | |
} | |
subscript (i: Int) -> String { |