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
final class newTableViewDataSource: NSObject { | |
private var tableSections: [Section] | |
init(header: Bool, footer: Bool) { | |
var sections: [Section] = [] | |
if header { | |
sections.append(Section.Header(rows: [ | |
Section.Row.HeaderLead(title: "Header"), |
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
final class OldTableDataSource: NSObject { | |
} | |
private extension OldTableDataSource { | |
enum Section: Int { | |
case Header, Body, Footer | |
static let numberOfSections = 3 | |
enum HeaderRows: Int { |
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 AutomaticDequeue { | |
} | |
extension AutomaticDequeue where Self: AnyObject { | |
static var reuseIdentifer: String { | |
return NSStringFromClass(self) as 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
xcodebuild -workspace [workspace] -scheme [scheme] clean build OTHER_SWIFT_FLAGS="-Xfrontend -debug-time-function-bodies" | grep .[0-9]ms | grep -v ^0.[0-9]ms | sort -nr > culprits.txt |
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/env ruby | |
require 'json' | |
def parse_line(line) | |
units = line.split("\t") | |
hash = {} | |
hash[:time] = parse_time(units[0]) | |
hash[:file] = parse_file(units[1]) | |
hash[:function] = units[2] |
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
func differenceFrom(otherRGBA: UIImage.RGBA) -> Int { | |
return Int(max(alpha, otherRGBA.alpha) - min(alpha, otherRGBA.alpha)) + | |
Int(max(red, otherRGBA.red) - min(red, otherRGBA.red)) + | |
Int(max(green, otherRGBA.green) - min(green, otherRGBA.green)) + | |
Int(max(blue, otherRGBA.green) - min(blue, otherRGBA.blue)) | |
} |
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
func differenceFrom(otherRGBA: UIImage.RGBA) -> Int { | |
let aDiff = Int(max(alpha, otherRGBA.alpha) - min(alpha, otherRGBA.alpha)) | |
let rDiff = Int(max(red, otherRGBA.red) - min(red, otherRGBA.red)) | |
let gDiff = Int(max(green, otherRGBA.green) - min(green, otherRGBA.green)) | |
let bDiff = Int(max(blue, otherRGBA.green) - min(blue, otherRGBA.blue)) | |
return aDiff + rDiff + gDiff + bDiff | |
} |
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 | |
enum JSONDecodingError: ErrorType { | |
case NilValueForProperty | |
case TypeMismatch | |
} | |
extension Dictionary where Key: StringLiteralConvertible, Value: AnyObject { | |
// Adds a Swift-y way to get a non-optional type from a key |
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
public extension UIViewKeyframeAnimationOptions { | |
// This exists because keyframe options doesn't expose the easing for the overall curve | |
public init(keyframeAnimationsOptions: UIViewKeyframeAnimationOptions, animationCurve: UIViewAnimationCurve) { | |
let animationOptions: UIViewAnimationOptions | |
switch animationCurve { | |
case .EaseIn: animationOptions = .CurveEaseIn | |
case .EaseInOut: animationOptions = .CurveEaseInOut | |
case .EaseOut: animationOptions = .CurveEaseOut | |
case .Linear: animationOptions = .CurveLinear | |
} |
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
private extension AppStyle { | |
func setupAppearance() { | |
setupNavBarAppearance() | |
setupTableViewCellAppearance() | |
setupTableAppearance() | |
} | |
func setupNavBarAppearance() { |
OlderNewer