Skip to content

Instantly share code, notes, and snippets.

View aataraxiaa's full-sized avatar
:octocat:
Focusing

Pete Smith aataraxiaa

:octocat:
Focusing
  • DuckDuckGo
  • 07:26 (UTC)
View GitHub Profile
@amlcurran
amlcurran / Completion.swift
Last active May 21, 2018 08:56
Better completion blocks by using higher order functions
func completion<Result>(onResult: @escaping (Result) -> Void, onError: @escaping (Error) -> Void) -> ((Result?, Error?) -> Void) {
return { (maybeResult, maybeError) in
if let result = maybeResult {
onResult(result)
} else if let error = maybeError {
onError(error)
} else {
onError(SplitError.NoResultFound)
}
}
import UIKit
protocol StoryboardBacked:class {
static func newFromStoryboardWithName(name:String?, bundle:NSBundle?) -> Self
}
extension StoryboardBacked {
static func newFromStoryboardWithName(name:String?, bundle:NSBundle?) -> Self {
let realName = name ?? NSStringFromClass(self as AnyClass).componentsSeparatedByString(".").last!
let storyboard = UIStoryboard(name: realName, bundle: bundle)
@Ashton-W
Ashton-W / Breakpoints_v2.xcbkptlist
Last active January 25, 2023 09:28
My User Breakpoints_v2.xcbkptlist
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "2"
version = "2.0">
<Breakpoints>
<!-- All Exceptions -->
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent