This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| import SpriteKit | |
| import GameplayKit | |
| // MARK: Utils | |
| private extension CGVector { | |
| var length: CGFloat { sqrt(dx * dx + dy * dy) } | |
| } | |
| // MARK: - MOVEMENT STATES (solo transiciones, SIN update) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| import SpriteKit | |
| import GameplayKit | |
| // MARK: - STATE MACHINES | |
| final class IdleState: GKState { | |
| weak var ship: ShipEntity? | |
| override func didEnter(from previousState: GKState?) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| // MARK: Thumb Stick View | |
| struct AnalogStickView: View { | |
| /// Devuelve un valor normalizado en el rango [-1, 1] para x e y | |
| @Binding var value: CGPoint | |
| @State private var innerCircleLocation: CGPoint = .zero | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| import SwiftUI | |
| import QuartzCore | |
| var lastMediaTime: CFTimeInterval? = nil | |
| struct YOffsetEffect: GeometryEffect { | |
| var y: CGFloat | |
| var animatableData: CGFloat { | |
| get { y } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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>( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // AudiowaveDemo.swift | |
| // RangeSlidersPlaygroun | |
| // | |
| // Created by Codelaby on 9/4/25. | |
| // | |
| import SwiftUI | |
| import AVKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct ChatMessageModel: Identifiable, Hashable, Sendable { | |
| var id: UUID = .init() | |
| let content: String | |
| let timestamp: Date | |
| let sender: String | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // CraterShape.swift | |
| // IOS18Playground | |
| // | |
| // Created by Codelay on 26/3/25. | |
| // | |
| import SwiftUI | |
| // Helper for animating three values |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
NewerOlder