Skip to content

Instantly share code, notes, and snippets.

@nbasham
nbasham / CodeTimer.swift
Created Apr 22, 2019
A simple way to time code using Swift.
View CodeTimer.swift
import Foundation
class CodeTimer {
var startTime: CFAbsoluteTime = 0
init() { start() }
func start() { startTime = CFAbsoluteTimeGetCurrent() }
func log(_ message: String) {
let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime
View gist:58802c851a8269c818707fc63f29cb54
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 {