Skip to content

Instantly share code, notes, and snippets.

View tests.swift
//-----------------------------------------------------------------------------
// MARK: Time Test
//-----------------------------------------------------------------------------
import Foundation
/// Prints the elapsed time to execute a block under whatever optimization
/// conditions are currently in use by the compiler
public func timetest(_ note: String, block: () -> Void) {
print("Starting Test:", note)
View modernizing.swift
/// Unconditionally prints a given message and stops execution.
///
/// - Parameters:
/// - reason: The string to print.
/// - function: The name of the calling function to print with `reason`. The
/// default is the calling scope where `fatalError(because:, function:, file:, line:)`
/// is called.
/// - file: The file name to print with `reason`. The default is the file
View invariant.swift
extension Never {
/// A developer facing statement explaining how program correctness has failed.
public struct Reason: CustomStringConvertible {
public let description: String
public init(_ rationale: String) {
self.description = rationale
}
}
}
View error.md
View fold.md
View keypath.md

Keypath Literal Getter Promotion

  • Proposal: SE-nnnn
  • Authors: TBD
  • Review Manager: TBD
  • Status: Awaiting implementation
View foldwithinout.md
View monoid.swift
import Foundation
// 3456789012345678901234567890123456789012345678901234567890123456789012345678
/*
Monoid reduction, for strictly binary operation combination.
Note: The monoid approach does not throw right now.
View fold.md
View ali.swift
import AppKit
struct AttributableString {
let attributedString: NSAttributedString
}
extension AttributableString: ExpressibleByStringLiteral {
init(stringLiteral: String) {
self.attributedString = NSAttributedString(string: stringLiteral)
}
You can’t perform that action at this time.