Skip to content

Instantly share code, notes, and snippets.

@trenskow
trenskow / Flow.swift
Created April 14, 2025 16:11
Flow layout SwiftUI
import SwiftUI
struct Flow: Layout {
struct PartialRect {
let subview: LayoutSubview
let x: CGFloat
let size: CGSize
}
@Koshimizu-Takehito
Koshimizu-Takehito / MazeGenerator.swift
Last active June 12, 2025 09:01
迷路生成ロジック
import Combine
import Foundation
// MARK: - MazeGenerator (Model)
/// An actor that generates a maze using a depth-first search (DFS) based approach.
/// 深さ優先探索 (DFS) ベースのアルゴリズムを用いて迷路を生成する。
///
/// This actor provides an async stream of snapshots (`MazeGenerator.Snapshot`) so that observers
/// can track the maze's state and generation progress in real time.
@TAATHub
TAATHub / ChipsSelection.swift
Last active April 17, 2025 18:21
Responsive Chips Selection
// Responsive Chips Selection
// See Also: https://youtu.be/T82izB2XBMA?si=Cnf6rGdyisG8ZWoX
import SwiftUI
struct Tag: Hashable {
var name: String
var color: Color
}

Unicode“同形字”

如果能提交任何您發現的錯誤,我將不勝感激。

肉 / 月 / 舟問題

舊字形的優點.png

肉 / 月

@1998code
1998code / ContentView.swift
Created February 28, 2025 14:08
Shimmer Effect 2025
// Copyright © 2025 MING
// MIT License
import SwiftUI
struct ContentView: View {
@State private var colorful: Bool = true
@State private var dragLocation: CGPoint = .zero
var body: some View {
#include <metal_stdlib>
using namespace metal;
float smoothMin(float x1, float x2, float k) {
float h = clamp(0.5 - 0.5 * (x2 - x1) / k, 0.0, 1.0);
return mix(x1, x2, h) - k * h * (1.0 - h);
}
float circleSDF(float2 point, float2 center, float radius) {
return length(point - center) - radius;
@morajabi
morajabi / FPSCounter.swift
Created December 29, 2024 19:16
An FPS Counter for macOS apps built for inline.chat
import AppKit
import Charts
import CoreVideo
import SwiftUI
struct FPSMeasurement: Identifiable, Equatable {
let id: Int
let fps: Int
static func == (lhs: FPSMeasurement, rhs: FPSMeasurement) -> Bool {
@f1shy-dev
f1shy-dev / best_SAE_trick.md
Last active June 16, 2025 15:42
sneakyf1shy's apple intelligence tutorial

the sneakyf1shy apple intelligence tutorial v2.0

Warning

This is patched as of iOS/iPadOS 18.1 DevBeta 5. If you want to follow this, stay on Beta 4.

This actually downloads the models, and is NOT just new SiriUI. Hence, this process is complex and probably not worth it.

⚠️ Prepare to be disappointed and annoyed, and have your time wasted! ⚠️

  • What does not work: Writing Tools, Memories, Reduce Interruptions, Image Eraser and other tools that are within official Apple Intelligence on supported devices.
import SwiftUI
// MARK: - ProgressRingScreen
/// A screen demonstrating a circular progress ring with a slider and control panel.
/// Uses a `ProgressRingViewModel` to track and animate the progress state.
struct ProgressRingScreen: View {
/// A view model that tracks and animates the progress value.
@State var viewModel = ProgressRingViewModel()
/* ==UserStyle==
@name gmail--mono
@namespace github.com/openstyles/stylus
@version 1.0.10
@description Implementation of https://x.com/guerriero_se/status/1792924958579900781.
@author Sebastiano Guerriero, Cyriaque 'cisoun' Skrapits
==/UserStyle== */
/*
* WARNING: Use Gmail's default theme with this!