Skip to content

Instantly share code, notes, and snippets.

protocol DomainEvent {
typealias Subscription = (Self) -> Void
static var notificationName: Notification.Name { get }
}
let DomainEventKey = "DomainEventKey"
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] })
}
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
class LinkedList<T>: Collection {
typealias Element = T
typealias Index = Int
typealias Iterator = IteratorImpl
final class IteratorImpl: IteratorProtocol {
typealias Element = T
private var cursor: Node?
import UIKit
class PathBuilder {
private var components: [String] = []
private var pathBase: String
init(pathBase: String) {
self.pathBase = pathBase
}