This file contains 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 HPicker<SelectionValue, Content>: View where SelectionValue: Hashable, Content: View { | |
private var items: [SelectionValue] | |
private var numberOfDisplays: Int | |
private var content: (SelectionValue) -> Content | |
@Binding private var selection: SelectionValue? | |
@State private var contentOffset: Double = 0 | |
@State private var itemWidth: Double = 100.0 |
This file contains 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 | |
// https://x.com/jrsaruo_tech/status/1893585977760743750 | |
@available(iOS 18, *) | |
struct HorizontalInlinePicker<SelectionValue, Content>: View where SelectionValue: Hashable, Content: View { | |
@Binding var selection: SelectionValue | |
@State private var centerValue: SelectionValue? |
This file contains 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 { | |
var body: some View { | |
WavingText() | |
.foregroundStyle(.white) | |
.frame(maxWidth: .infinity, maxHeight: .infinity) | |
.background(Color(hue: 220/360, saturation: 0.3, brightness: 0.9)) | |
} | |
} |
This file contains 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 ShaderView: View { | |
let name: String | |
private let start = Date() | |
var body: some View { | |
let shader = ShaderFunction(library: .default, name: name) | |
TimelineView(.animation) { context in | |
let seconds = context.date.timeIntervalSince(start) |
This file contains 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: - Model | |
@MainActor | |
@Observable | |
final class Model { | |
var angles: [[Angle]] | |
init(row: Int, column: Int) { | |
angles = (0..<row).map { _ in |
This file contains 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 React, { useState } from 'react'; | |
import { Pressable, View } from 'react-native'; | |
import Animated, { css } from 'react-native-reanimated'; | |
export default function Wave() { | |
const [clickLocation, setClickLocation] = useState({ x: -1, y: -1 }); | |
const dots = Array.from({ length: 323 }); | |
const size = 19; | |
const color = `rgb(${Math.random() * 255}, ${Math.random() * 255}, ${Math.random() * 255})` |