Skip to content

Instantly share code, notes, and snippets.

//
// 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
import SwiftUI
import JunoSlider
struct ContentView: View {
@State var sliderValue: CGFloat = 0.5
@State var isSliderActive = false
var body: some View {
VStack {
Image(systemName: "globe")
import SwiftUI
struct BottomSheet: View {
@State private var showSheet = false
@State private var scrollToId = 0
@State private var listView = true
import SwiftUI
private struct OnFirstAppear: ViewModifier {
let perform: () -> Void
@State private var firstTime = true
func body(content: Content) -> some View {
content.onAppear {
if firstTime {
import SwiftUI
struct SearchableStudy: View {
// !! Searchable searchCompletion() seems to have problem
// handling terms with common prefix like "Josh" and "Joshee"
// Try enter "Jos" and tap the "Josh" entery, it doesn't show
// the "Josh" entry. It show "Joshee" completion.
let names = ["Hellen", "Holly", "Josh", "Joshee", "Rhonda", "Ted"]
@State private var searchText = ""
//
// BricsLogo.swift
// iOS17-New-Beginning
//
// Created by Matthew Young on 10/22/23.
//
import SwiftUI
extension ShapeStyle where Self == LinearGradient {
@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 {
//
// AnimatedSpeakerVolumeWaveSlash.swift
// iOS17-New-Beginning
//
// Created by Matthew Young on 10/12/23.
//
import SwiftUI
struct SpeakerVolumeView: View {
@mattyoung
mattyoung / RainbowDashlineAnimation.swift
Created October 5, 2023 20:18
RainbowDashlineAnimation.swift
//
// Created by Matthew Young on 10/4/23.
//
import SwiftUI
struct MatchedInnerOuterCornerRadius: View {
@State private var phase = Double.zero
var body: some View {
import SwiftUI
import ComposableArchitecture
struct CounterFeature: Reducer {
struct State: Equatable {
var count = 99
var numberFactAlert: String?
}
enum Action: Equatable {