Skip to content

Instantly share code, notes, and snippets.

View AdrianTDC's full-sized avatar

Adrian Bolinger AdrianTDC

  • 15:02 (UTC -04:00)
View GitHub Profile
@simonbs
simonbs / UserDefault.swift
Last active August 2, 2025 16:09
Property wrapper that stores values in UserDefaults and works with SwiftUI and Combine.
/**
* I needed a property wrapper that fulfilled the following four requirements:
*
* 1. Values are stored in UserDefaults.
* 2. Properties using the property wrapper can be used with SwiftUI.
* 3. The property wrapper exposes a Publisher to be used with Combine.
* 4. The publisher is only called when the value is updated and not
* when_any_ value stored in UserDefaults is updated.
*
* First I tried using SwiftUI's builtin @AppStorage property wrapper
@shnhrrsn
shnhrrsn / String+Hashing.swift
Created September 30, 2019 23:55
Swift CryptoKit MD5/SHA1 Hash
import Foundation
import CryptoKit
private protocol ByteCountable {
static var byteCount: Int { get }
}
extension Insecure.MD5: ByteCountable { }
extension Insecure.SHA1: ByteCountable { }