Skip to content

Instantly share code, notes, and snippets.

Avatar

Peter Schorn Peter-Schorn

View GitHub Profile
@Peter-Schorn
Peter-Schorn / XShape.swift
Last active Feb 4, 2022
X Shape in SwiftUI
View XShape.swift
import SwiftUI
/**
An X shape.
To ensure the shape is square, add the following modifier:
```
.aspectRatio(1, contentMode: .fit)
```
*/
@Peter-Schorn
Peter-Schorn / CustomAppStorage.swift
Last active Dec 16, 2021
SwiftUI AppStorage Reimplementation
View CustomAppStorage.swift
import Foundation
import SwiftUI
import Combine
@propertyWrapper public struct CustomAppStorage<Value>: DynamicProperty {
private class Observer: NSObject, ObservableObject {
private let store: UserDefaults
private let key: String