Skip to content

Instantly share code, notes, and snippets.

@mattyoung
mattyoung / RubberBandSwitch.swift
Last active October 13, 2023 04:02 — forked from alikaragoz/RubberBandSwitch.swift
iOS Control Center Rubber Band Swift
import SwiftUI
// had to move this out here due to RubberBandSwitch is now generic
enum Const {
static let shapeSize: CGSize = .init(width: 90.0, height: 190.0)
static let cornerRadius: CGFloat = 26.0
}
struct RubberBandSwitch<Icon: View>: View {
@mattyoung
mattyoung / Example_Complex.swift
Last active July 31, 2020 10:31 — forked from IanKeen/Example_Complex.swift
PropertyWrapper: @transaction binding for SwiftUI to make changes to data supporting commit/rollback
struct User: Equatable {
var firstName: String
var lastName: String
}
@main
struct MyApp: App {
@State var value = User(firstName: "", lastName: "")
@State var showEdit = false