Skip to content

Instantly share code, notes, and snippets.

View aChase55's full-sized avatar

Alex Chase aChase55

  • Los Angeles
View GitHub Profile
@aChase55
aChase55 / AsyncOperation.swift
Last active September 19, 2018 16:50
An Operation subclass that does work asynchronously
import Foundation
class AsyncOperation: Operation {
private var _isFinished: Bool = false
private var _isExecuting: Bool = false
open func execute() { assertionFailure("Overide execute() in subclass") }
override var isAsynchronous: Bool { return true }
#if defined(TARGET_IOS) || defined(TARGET_TVOS)
@import UIKit;
#define PlatformViewController UIViewController
#else
@import AppKit;
#define PlatformViewController NSViewController
#endif
// Our view controller
@interface MyViewController : PlatformViewController
@aChase55
aChase55 / UIColor+Array.swift
Created February 13, 2018 05:46
Expressing RGB Colors as Arrays in Swift
//Cleanly instantiate UIColors using 1 or 3 Int, Double, Float, or CGFloat Values
//UIColor convience initializer UIColor(4, 20, 69)
//UIColor convience initializer for gray(all three values the same) UIColor(69)
//Instantiate gray from a number: 210.rgbTriple()
//Instantiate color from an array of numbers:[40, 33, 60].rgbColor()
//Optionally express an alpha value
//UIColor(4, 20, 69, 0.4)

Keybase proof

I hereby claim:

  • I am achase55 on github.
  • I am achase (https://keybase.io/achase) on keybase.
  • I have a public key ASBaMNAosgYvs_nf0BLeiB9kEk4a3oNUrpVmzx2fgUhNlgo

To claim this, I am signing this object: