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 |
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
// | |
// ContentView.swift | |
// AnimationTimingCurve | |
// | |
// Created by Chris Eidhof on 25.09.19. | |
// Copyright © 2019 Chris Eidhof. All rights reserved. | |
// | |
import SwiftUI |
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 | |
// 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 { |
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
// | |
// FloatingOverlayApp.swift | |
// FloatingOverlay | |
// | |
// Created by JuniperPhoton on 2025/3/12. | |
// | |
import SwiftUI | |
// Dependency: https://github.com/sindresorhus/KeyboardShortcuts |
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 | |
public struct Shimmer: AnimatableModifier { | |
private let gradient: Gradient | |
@State private var position: CGFloat = 0 | |
public var animatableData: CGFloat { | |
get { position } |
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 DotPosition: Equatable, Hashable { | |
let row: Int | |
let column: Int | |
} | |
struct DotGridView: View { |
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 BezierGridView: View { | |
@State private var vertices: [[BezierVertex]] | |
let rows: Int | |
let cols: Int | |
init(rows: Int, cols: Int) { | |
self.rows = rows |
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 ContentView: View { | |
@State private var start = Date.now | |
var body: some View { | |
VStack { | |
TimelineView(.animation) { timeline in | |
let time = start.distance(to: timeline.date) | |
Rectangle() |
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 MetalKit | |
struct Particle { | |
let color: SIMD4<Float> | |
let radius: Float | |
let lifespan: Float | |
let position: SIMD2<Float> | |
let velocity: SIMD2<Float> | |
} |