Skip to content

Instantly share code, notes, and snippets.

View vistar941's full-sized avatar

ビスター(Vistar) vistar941

View GitHub Profile
@Kyle-Ye
Kyle-Ye / .lldbinit-swiftui
Last active August 3, 2026 20:15
Print SwiftUI DisplayList.minimalDescription via LLDB
command script import --relative-to-command-file swiftui_displaylist_minimal_description.py
//
// BlobView.swift
// Prototypes
//
// Created by Shubham on 07/07/26.
//
import SwiftUI
struct BlobView: View {
@k16shikano
k16shikano / SKILL.md
Last active August 9, 2026 17:02
japanese-tech-writing/SKILL
name japanese-tech-writing
description 日本語の技術文書・書籍原稿の文章規範。整形(一文一行、引用ブロック、脚注、コラム記法)、段落と論証の構成(パラグラフライティング)、論証の厳密さ(ツッコミどころの除去)、読み手の負荷の管理、視点と語り、演出の抑制、LLM っぽい空句の禁止、冗長の排除を定める。日本語で技術書の章、草稿、記事、解説文を書くとき、または推敲・リライトするときに使用する。

日本語技術文書の文章規範

日本語で技術的な原稿(書籍の章、記事、解説文)を書く・推敲するときは、以下の規範に従う。

整形

# Owning binary : TextComposerRuntime
# Status : NEW in iOS 27 (not in 26.5.1)
# Source : embedded __cstring in dyld_shared_cache_arm64e (24A5355q)
======================================================================
# Task Overview:
You are a composition agent that helps users create personalized written content (emails, messages, documents, posts, stories, etc.)
As an Assistant, you must:
1. Analyze the request to determine if you have sufficient information
@sebjvidal
sebjvidal / NSLayoutConstraintBuilder.swift
Created May 7, 2026 20:01
NSLayoutConstraint Result Builder
import UIKit
@resultBuilder
struct NSLayoutConstraintBuilder {
static func buildBlock(_ components: [NSLayoutConstraint]...) -> [NSLayoutConstraint] {
components.flatMap { $0 }
}
static func buildExpression(_ expression: NSLayoutConstraint) -> [NSLayoutConstraint] {
[expression]
@sebjvidal
sebjvidal / ViewController.swift
Created April 19, 2026 21:32
Collection View Layout Margins Demo
private func setupCollectionView() {
let layout = UICollectionViewCompositionalLayout { [unowned self] section, environment in
let spacing: CGFloat = 8
let numberOfColumns: CGFloat = 5
let numberOfSpacers: CGFloat = numberOfColumns - 1
let contentWidth = collectionView.layoutMarginsGuide.layoutFrame.width
let itemWidth = (contentWidth - numberOfSpacers * spacing) / numberOfColumns
let layoutItemSize = NSCollectionLayoutSize(widthDimension: .absolute(itemWidth), heightDimension: .fractionalHeight(1))
@Kyle-Ye
Kyle-Ye / disable-calayersystem-swiftui-ios26.md
Created March 8, 2026 18:12
Disabling CALayerSystem Behavior in SwiftUI on iOS 26

Disabling CALayerSystem Behavior in SwiftUI on iOS 26

Starting with iOS 26, SwiftUI's UIHostingView may use CALayer-based rendering (caLayerSystem) instead of the traditional UIKit-based rendering (uikitSystem) when certain conditions are met. This can cause unexpected changes in the view hierarchy — for example, _UIGraphicsView and CGDrawingView subviews may be replaced by plain CALayer and CGDrawingLayer sublayers.

Here are two approaches to temporarily disable this behavior in your local debug environment.

Option 1: Environment Variable

Set the environment variable SWIFTUI_DISABLE_MIXED_VIEW_HIERARCHY=1 in your scheme's Run configuration (Edit Scheme → Run → Arguments → Environment Variables).

@timi2506
timi2506 / CoverFlip.swift
Created February 26, 2026 15:53
CoverFlip
//
// CoverFlip.swift
// CoverFlip
//
// Created by Tim on 26.02.26.
//
import SwiftUI
struct CoverFlipTransition: AnimatableModifier {
@radiofun
radiofun / DistortionTransition.metal
Created January 4, 2026 17:20
DistortionTransition.metal
[[ stitchable ]] half4 distortionWithScale(float2 pos, SwiftUI::Layer l, float4 boundingRect, float2 dragp, float progress) {
float2 delta = pos - dragp;
float dist = length(delta);
// Define the influence of the "force" from the drag point
float radius = 155.0; // Radius of effect
float strength = 0.8; // How much it pulls
// Influence peaks at 0.5, is 0 at 0.3 and 1.0 - you can customize these values.
float progressinfluence = smoothstep(0.3, 0.5, progress) * (1.0 - smoothstep(0.5, 1.0, progress));
@Mcrich23
Mcrich23 / _UIViewGlass.swift
Last active January 3, 2026 20:56
A function that creates a _UIViewGlass object with the correctly numbered variant. All in swift!
public func _UIViewGlass(variant: Int) -> NSObject? {
let glassClass = objc_lookUpClass("_UIViewGlass")! as AnyObject
let glass = glassClass._alloc()._init(variant: variant)
return glass as? NSObject
}
/// Registers Objective-C methods Swift needs.
fileprivate final class PrivateSelectors: NSObject {
@objc(alloc)