I hereby claim:
- I am brandonshega on github.
- I am bshega (https://keybase.io/bshega) on keybase.
- I have a public key ASA9VwW7yXulOo0DGhcJVrb4h5wUC--U1wzHrPuYzmQG6Qo
To claim this, I am signing this object:
//: Playground - noun: a place where people can play | |
import UIKit | |
import XCPlayground | |
import PlaygroundSupport | |
extension UINavigationController { | |
func popViewController(completion: @escaping () -> ()) { | |
CATransaction.begin() | |
CATransaction.setCompletionBlock(completion) |
var queue = Queue<String>() | |
queue.enqueue("Hello") | |
queue.enqueue("World") | |
queue.dequeue() // "Hello" | |
queue.dequeue() // "World" | |
queue.dequeue() // nil |
protocol Iteratable {} | |
extension RawRepresentable where Self: RawRepresentable { | |
static func iterateEnum<T: Hashable>(_: T.Type) -> AnyIterator<T> { | |
var i = 0 | |
return AnyIterator { | |
let next = withUnsafePointer(to: &i) { | |
$0.withMemoryRebound(to: T.self, capacity: 1) { $0.pointee } | |
} | |
if next.hashValue != i { return nil } | |
i += 1 |
I hereby claim:
To claim this, I am signing this object:
//: Playground - noun: a place where people can play | |
import UIKit | |
import Foundation | |
import PlaygroundSupport | |
let allStates = ["Alaska", | |
"Alabama", | |
"Arkansas", | |
"American Samoa", |
//: Playground - noun: a place where people can play | |
import UIKit | |
import Foundation | |
import PlaygroundSupport | |
protocol MyDelegate: class { | |
func didTapButton() | |
} |
func balanceStatements(_ list: String) -> String { | |
var totalBuy = 0 | |
var totalSell = 0 | |
var malformedCount = 0 | |
var malformedOrders = [String]() | |
let pattern = "\\w+ \\w+ \\d+\\.\\d+ \\w+" | |
let orders = list.components(separatedBy: ",").filter { !$0.isEmpty } | |
for order in orders { |
//: Playground - noun: a place where people can play | |
import UIKit | |
import PlaygroundSupport | |
var str = "Hello, playground" | |
protocol EditViewControllerDelegate: class { | |
func didFinishEditing() | |
} |
import XCTest | |
class PlaygroundTestObserver: NSObject, XCTestObservation { | |
@objc func testCase(_ testCase: XCTestCase, didFailWithDescription description: String, inFile filePath: String?, atLine lineNumber: UInt) { | |
print("Test failed on line \(lineNumber): \(testCase.name), \(description)") | |
} | |
} | |
struct TestRunner { | |
func runTests(testClass: AnyClass) { |
//: Playground - noun: a place where people can play | |
import UIKit | |
import PlaygroundSupport | |
var str = "Hello, playground" | |
class MainViewController: UIViewController { | |
let button: UIButton = { |