- Install
brew
brew install ffmpeg
??brew install ffmpeg imagemagick gifsicle pkg-config
brew cask install xquartz
brew install gifsicle
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
/// Return a new function that will be called only once after `delay` time passed between invocation | |
func debounce(delay: TimeInterval, queue: DispatchQueue = .main, function: @escaping () -> Void) -> () -> Void { | |
var currentWorkItem: DispatchWorkItem? | |
return { | |
currentWorkItem?.cancel() | |
currentWorkItem = DispatchWorkItem { function() } | |
queue.asyncAfter(deadline: .now() + delay, execute: currentWorkItem!) | |
} | |
} |
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
// | |
// Reflectable.swift | |
// | |
// Created by Nathan Tannar on 2018-12-04. | |
// | |
import Foundation | |
// Add this protocol to your `struct` or `class` | |
protocol Reflectable { |
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
name | download_total | |
---|---|---|
AFNetworking | 61983241 | |
Fabric | 50998892 | |
Crashlytics | 49667729 | |
SDWebImage | 45471101 | |
Alamofire | 42097177 | |
CocoaLumberjack | 36071914 | |
Bolts | 35294870 | |
FirebaseInstanceID | 30277793 | |
FirebaseAnalytics | 30254593 |
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 LayoutGuideProvider { | |
var leadingAnchor: NSLayoutXAxisAnchor { get } | |
var trailingAnchor: NSLayoutXAxisAnchor { get } | |
var leftAnchor: NSLayoutXAxisAnchor { get } | |
var rightAnchor: NSLayoutXAxisAnchor { get } | |
var topAnchor: NSLayoutYAxisAnchor { get } | |
var bottomAnchor: NSLayoutYAxisAnchor { get } | |
var widthAnchor: NSLayoutDimension { get } | |
var heightAnchor: NSLayoutDimension { get } | |
var centerXAnchor: NSLayoutXAxisAnchor { get } |
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 | |
import PlaygroundSupport | |
class Responder: NSObject { | |
@objc func segmentedControlValueChanged(_ sender: UISegmentedControl) { | |
UIView.animate(withDuration: 0.3) { | |
buttonBar.frame.origin.x = (segmentedControl.frame.width / CGFloat(segmentedControl.numberOfSegments)) * CGFloat(segmentedControl.selectedSegmentIndex) | |
} |
Author: Chris Lattner
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
// Created by Caleb Davenport on 7/14/17. | |
import UIKit | |
final class ActionSheetPresentationController: UIPresentationController { | |
// MARK: - Properties | |
private var dimmingView: UIView! |
- Proposal: SE-XXXX
- Authors: Chris Lattner, Joe Groff
Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.
This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.
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
// Created by Vasily Ulianov on 09.02.17, updated in 2019. | |
// License: MIT | |
import Foundation | |
/// Subclass of `Operation` that adds support of asynchronous operations. | |
/// 1. Call `super.main()` when override `main` method. | |
/// 2. When operation is finished or cancelled set `state = .finished` or `finish()` | |
open class AsynchronousOperation: Operation { | |
public override var isAsynchronous: Bool { |
NewerOlder