Skip to content

Instantly share code, notes, and snippets.

@nbasham
nbasham / CodeTimer.swift
Created April 22, 2019 23:45
A simple way to time code using Swift.
import Foundation
class CodeTimer {
var startTime: CFAbsoluteTime = 0
init() { start() }
func start() { startTime = CFAbsoluteTimeGetCurrent() }
func log(_ message: String) {
let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime
import SwiftUI
public enum Enum1: Int, Codable, CaseIterable, CustomStringConvertible {
public var description: String {
return "\(rawValue)"
}
case one, two, three
}
public enum Enum2: String, Codable, CaseIterable, CustomStringConvertible {