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 | |
/// https://source.unsplash.com | |
public struct Unsplash { | |
public struct Source: RawRepresentable { | |
public let rawValue: String | |
public init(rawValue: String) { | |
self.rawValue = rawValue | |
} |
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 | |
/// A type that privides mutation interface for a wrapped value. | |
public struct Mutation<Value> { | |
/// The wrapped value. | |
public var value: Value | |
/// Creates an instance that wraps the given value. | |
/// | |
/// - Parameter value: The value to store. |
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
#!/usr/bin/swift | |
import Darwin | |
signal(SIGINT) { _ in | |
print("🆖") | |
} | |
let konami = "↑↑↓↓←→←→BA" |
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 | |
final class Subject<Value> { | |
let dispatchQueue: DispatchQueue | |
private static func makeDefaultDispatchQueue() -> DispatchQueue { | |
return DispatchQueue(label: String(reflecting: self), qos: .default, attributes: .concurrent) | |
} | |
private struct Observation { |
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
// | |
// CVError.swift | |
// | |
// Created by Jun Tanaka on 2016/12/13. | |
// Copyright © 2016 Jun Tanaka. All rights reserved. | |
// | |
import CoreVideo | |
public enum CVError: Int32, Error { |
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
// | |
// EventPresenter.swift | |
// | |
// Created by Jun Tanaka on 2016/10/27. | |
// Copyright © 2016 Jun Tanaka. All rights reserved. | |
// | |
import Foundation | |
private struct EventObserver<Event> { |
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 | |
final class LayerView<Layer: CALayer>: UIView { | |
var implicitAnimationsEnabled: Bool = false | |
var implicitlyAnimatableEvents: [String]? = nil | |
var genericLayer: Layer { | |
return layer as! Layer | |
} |
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 QuartzCore | |
private extension CAAnimation { | |
final class Delegate: NSObject { | |
var startHandlers = Array<StartHandler>() | |
var stopHandlers = Array<StopHandler>() | |
override func animationDidStart(anim: CAAnimation) { | |
startHandlers.forEach { $0(animation: anim) } | |
} |
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
// | |
// AVPlayer+Repeat.swift | |
// | |
// Created by Jun Tanaka on 4/1/16. | |
// Copyright © 2016 eje Inc. All rights reserved. | |
// | |
import AVFoundation | |
private final class RepeatManager: NSObject { |
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 QuartzCore | |
import OpenGLES | |
extension CAEAGLLayer { | |
func takeSnapshot(from renderBuffer: GLuint? = nil) -> UIImage { | |
var bufferWidth: GLint = 0 | |
var bufferHeight: GLint = 0 | |
if let buffer = renderBuffer { | |
glBindRenderbufferOES(GLenum(GL_RENDERBUFFER_OES), buffer) |
NewerOlder