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 birthday = Todd.birthday // gets my birthday | |
let now = NSDate() | |
let secondsDifference = now.timeIntervalSinceDate(birthday) | |
let secondsPerDay = 60*60*24 // 60 seconds * 60 minutes * 24 hours | |
let daysSinceBirthday = secondsDifference / secondsPerDay |
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
// get an objects type | |
lldb: po type(of: yourObject) | |
// info dump on an object | |
lldb: po dump(youObject) |
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
source 'https://github.com/CocoaPods/Specs.git' | |
platform :ios, '9.0' | |
use_frameworks! | |
target 'lavaApp' do | |
pod 'ARSLineProgress', '~> 2.0' | |
pod 'Alamofire', '~> 4.0' | |
pod 'Willow', '~> 2.0' | |
pod 'SwiftyJSON', '~> 3.1.1' |
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
@IBOutlet weak var lavaButton: UIButton! { | |
didSet { | |
lavaButton.tintColor = UIColor.lavaColor() | |
} | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} |
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
import UIKit | |
import MapKit | |
class MapViewController: UIViewController, CLLocationManagerDelegate { | |
@IBOutlet weak var mapView: MKMapView! | |
/// Location manager used to start and stop updating location. | |
let manager = CLLocationManager() | |
var receivedLocationCount = 0 |
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
import Foundation | |
import XCTest | |
/// Basic sanity check that ensures that we are able to retrieve localized strings for all languages | |
/// we support. | |
final class L10NTests: XCTestCase { | |
func testLocalizations() { | |
let locales = ["en", "es", "zh-Hans", "zh-Hant", "fi"] | |
for locale in locales { |
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
enum LavaError: Error { | |
case LavaNotHotError | |
case LavaTooHotError | |
} | |
struct LavaSpecialResponseCode: Error { | |
enum ErrorKind: Int { | |
case missingParams | |
case badData | |
} |
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
// NOTE: important to be aware that your reporting that your async is on is not on main thread | |
// see also https://developer.apple.com/library/content/samplecode/avexporter/Listings/Swift_AVFoundationExporter_main_swift.html | |
// An Interested party such as a UIViewController (the call site of embedWatermark, for example) can register as delegate | |
// and update progress indicators (like a UIProgressView or UILabel). | |
protocol VideoProcessingProgressDelegate { | |
func watermarkProgressUpdated(progress: Float) | |
} | |
class VideoProcessingProgressExample { |
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
// UIImage+Downsample.swift | |
// Created by Todd Hopkinson | |
import UIKit | |
extension UIImage { | |
func downsample(reductionAmount: Float) -> UIImage? { | |
let image = UIKit.CIImage(image: self) |
OlderNewer