Skip to content

Instantly share code, notes, and snippets.

import SwiftUI
struct SensoryFeedback: View {
@State private var count = 0
var body: some View {
VStack {
Text(verbatim: "\(count)")
.font(.largeTitle)
.contentTransition(.numericText(value: Double(count)))
//
// AnimatableNumber.swift
// SwiftUI30WWDC2021
//
// Created by Mateo on 4/19/22.
//
// https://stefanblos.com/posts/animating-number-changes/
import SwiftUI
extension AttributedString {
// call this init to make all the `code` block highlighted in specific way:
init(codeHightlighted key: String.LocalizationValue) {
var result = AttributedString(localized: key)
let highlight = AttributeContainer.foregroundColor(.red).backgroundColor(.mint)
result.replaceAttributes(AttributeContainer.inlinePresentationIntent(.code), with: highlight)
self = result
}
//
// SFSymbolImage.swift
// SFSymbolVariableValueAnimationWrong
//
// Created by Matthew Young on 12/22/22.
//
import SwiftUI
struct AnimatableVariableValueModifier: Animatable, ViewModifier {
import SwiftUI
// pre-create one instance of MeasurementFormatter for our format needs
// re-use as needed
extension MeasurementFormatter {
static private let formatter: MeasurementFormatter = {
let formatter = MeasurementFormatter()
let numberFormatter = NumberFormatter()
numberFormatter.numberStyle = .decimal
numberFormatter.minimumFractionDigits = 2
//
// AnimatedSlashSpeakerDemo.swift
// SwiftUITestingProject
//
// Created by Matthew on 12/25/19.
// Copyright © 2019 Matthew. All rights reserved.
//
// Speaker animated slash and sound waves
//
// VolumeSlider.swift
// TristateToggleProject
//
// Created by Matthew Young on 12/3/19.
// Copyright © 2019 Matthew Young. All rights reserved.
//
// https://stackoverflow.com/questions/58286350/how-to-create-custom-slider-by-using-swiftui
// https://forums.swift.org/t/how-to-use-swiftui-anygesture-why-is-it-not-like-anyview/31624
//
// LikeView.swift
// lottie-first
//
// Created by Matthew Young on 12/31/22.
//
import SwiftUI
import Lottie
extension Color {
// Rainbow colors
static let rainbowBlue = Color(red: 30 / 255, green: 158 / 255, blue: 221 / 255)
static let rainbowGraphite = Color(red: 92 / 255, green: 92 / 255, blue: 92 / 255)
static let rainbowOrange = Color(red: 240 / 255, green: 132 / 255, blue: 4 / 255)
static let rainbowPacificBlue = Color(red: 54 / 255, green: 82 / 255, blue: 97 / 255)
static let rainbowPurple = Color(red: 146 / 255, green: 61 / 255, blue: 158 / 255)
//
static let rainbowRed = Color(red: 216 / 255, green: 61 / 255, blue: 56 / 255)
static let rainbowSilver = Color(red: 204 / 255, green: 204 / 255, blue: 204 / 255)
//
// ContentView.swift
// ColorCodable
//
// Created by Mateo on 5/26/22.
//
import SwiftUI