Skip to content

Instantly share code, notes, and snippets.

View Codelaby's full-sized avatar

Codelaby Codelaby

View GitHub Profile
@Codelaby
Codelaby / TapableVinylView.swift
Created April 20, 2025 18:13
Play/pause loop animation swiftui
import SwiftUI
struct Cancel: CustomAnimation {
func animate<V: VectorArithmetic>(
value: V, time: TimeInterval, context: inout AnimationContext<V>
) -> V? {
return nil // Fin inmediato
}
func shouldMerge<V>(
@Codelaby
Codelaby / ExpandableFAB.swift
Last active April 13, 2025 10:18
Expandable Floating Action Button
import SwiftUI
// MARK: Expandable Floating Action Button
struct ExpandableFAB<Content: View>: View {
@Binding var isPresented: Bool
@ViewBuilder var content: Content
var body: some View {
VStack {
@Codelaby
Codelaby / WaveformScrubber.swift
Created April 10, 2025 07:47
Wave form Scrubber
//
// AudiowaveDemo.swift
// RangeSlidersPlaygroun
//
// Created by Codelaby on 9/4/25.
//
import SwiftUI
import AVKit
import SwiftUI
struct ChatMessageModel: Identifiable, Hashable, Sendable {
var id: UUID = .init()
let content: String
let timestamp: Date
let sender: String
}
@Codelaby
Codelaby / Curve_experiments.swift
Created March 26, 2025 10:19
Curve experiments
//
// CraterShape.swift
// IOS18Playground
//
// Created by Codelay on 26/3/25.
//
import SwiftUI
// Helper for animating three values
@Codelaby
Codelaby / coroutines-recursion.swift
Created March 22, 2025 18:05 — forked from adellibovi/coroutines-recursion.swift
Recursion with Swift Coroutines
import Foundation
class Tree {
let left, right: Tree?
init(left: Tree?, right: Tree?) {
self.left = left
self.right = right
}
}
let tree = (1..<100000000).reduce(Tree(left: nil, right: nil), { prev, result in
//
// ContentView.swift
// AnimationTimingCurve
//
// Created by Chris Eidhof on 25.09.19.
// Copyright © 2019 Chris Eidhof. All rights reserved.
//
import SwiftUI
@Codelaby
Codelaby / view_snapshot.swift
Created March 19, 2025 08:35
snapshot View to image in swift
/// Renders `View` as `UIImage`.
extension View {
func snapshot(renderOnce: UnsafeMutablePointer<Bool>? = nil) -> UIImage? {
if let flag = renderOnce, flag.pointee {
return nil
}
renderOnce?.pointee = true
let renderer = ImageRenderer(content: self)
renderer.scale = UIScreen.main.scale
@Codelaby
Codelaby / ReorderableListExample.swift
Created March 17, 2025 09:26 — forked from JEuler/ReorderableListExample.swift
SwiftUI Reorder With Buttons List Example
import SwiftUI
// Simple example of a custom reordering implementation in SwiftUI
struct ReorderableListExample: View {
// Sample data
@State private var items = ["Item 1", "Item 2", "Item 3", "Item 4", "Item 5"]
@State private var isEditMode: EditMode = .inactive
var body: some View {
VStack {
@Codelaby
Codelaby / FloatingOverlayApp.swift
Created March 15, 2025 08:38 — forked from JuniperPhoton/FloatingOverlayApp.swift
A simple application to show a black, resizable, title-less, always-on-top NSWindow on Mac.
//
// FloatingOverlayApp.swift
// FloatingOverlay
//
// Created by JuniperPhoton on 2025/3/12.
//
import SwiftUI
// Dependency: https://github.com/sindresorhus/KeyboardShortcuts