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 | |
class PathBuilder { | |
private var components: [String] = [] | |
private var pathBase: String | |
init(pathBase: String) { | |
self.pathBase = pathBase | |
} | |
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
class LinkedList<T>: Collection { | |
typealias Element = T | |
typealias Index = Int | |
typealias Iterator = IteratorImpl | |
final class IteratorImpl: IteratorProtocol { | |
typealias Element = T | |
private var cursor: Node? |
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
class Trulean<T> { | |
class Empty: Trulean<T> { | |
override func onFalse(_ eval: @autoclosure () throws -> T) rethrows -> T { | |
return try eval() | |
} | |
} | |
class Full: Trulean<T> { | |
let _value: T |
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
class TrackSelectionStrategy { | |
static let straight: TrackSelectionStrategy = Straight() | |
static let shuffle: TrackSelectionStrategy = Shuffle() | |
fileprivate init() {} | |
func nextItem(_ sender: AudioPlayerImpl) -> AudioPlayerItem? { | |
return self.nextItemIndex(sender).map({ sender._items[$0] }) | |
} |
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 DomainEvent { | |
typealias Subscription = (Self) -> Void | |
static var notificationName: Notification.Name { get } | |
} | |
let DomainEventKey = "DomainEventKey" |
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 | |
import UIKit | |
class RTTableViewControllerSectionModel: NSObject { | |
let cellModels: [RTTableViewControllerCellModel] | |
let tableView: UITableView | |
required init(_ tableView: UITableView, _ cellModels: [RTTableViewControllerCellModel]) { | |
self.tableView = tableView |
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 performWithErrorPointer<T>(_ executable: @autoclosure @escaping () throws -> T, _ errorPointer: NSErrorPointer) -> T? { | |
do { | |
return try executable() | |
} | |
catch let error { | |
errorPointer?.pointee = error as NSError | |
return nil | |
} | |
} |
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 | |
class TableViewContainerCell<Content: UIView>: UITableViewCell { | |
var content: Content | |
override init(style: UITableViewCellStyle, reuseIdentifier: String?) { | |
if let viewFromNib = Content.loadDefaultNib() { | |
content = viewFromNib | |
} |
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
class Logger { | |
static var defaultLogger = Logger() | |
func log(_ message: String) { | |
print(message) | |
} | |
} |
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 | |
class CancellableDecorator { | |
private class Token { | |
var isValid = true | |
} | |
private var token: Token? |
NewerOlder