Skip to content

Instantly share code, notes, and snippets.

Avatar

Rudolf Adamkovič salutis

View GitHub Profile
@salutis
salutis / PreconditionFailable.swift
Last active Dec 3, 2017
PreconditionFailable protocol
View PreconditionFailable.swift
/* PRODUCTION */
protocol PreconditionFailable {
associatedtype PreconditionFailure
}
extension PreconditionFailable {
static func precondition(_ condition: Bool, _ message: PreconditionFailure) {
guard !condition else { return }
PreconditionFailureHandler.trap(String(describing: message))