Skip to content

Instantly share code, notes, and snippets.

View Chronos2500's full-sized avatar

ビスター Chronos2500

View GitHub Profile
@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)
@sebjvidal
sebjvidal / ViewController.swift
Created November 4, 2025 09:21
UIGlassContainerEffect-Demo
//
// ViewController.swift
// UIGlassContainerEffect-Demo
//
// Created by Seb Vidal on 04/11/2025.
//
import UIKit
import MapKit
@Kyle-Ye
Kyle-Ye / ContentView.swift
Last active October 14, 2025 01:49
SwiftUI implicitRootType Playground
// Usage: ViewGraph.current.append(feature: HStackImplicitFeature())
struct HStackImplicitFeature: ViewGraphFeature {
func modifyViewInputs(inputs: inout _ViewInputs, graph: ViewGraph) {
inputs.implicitRootType = _HStackLayout.self
}
}
struct ContentView: View {
var body: some View {
ChildView1()
@Kyle-Ye
Kyle-Ye / kdebug_interpose.c
Created October 3, 2025 12:15
Make kdebug_is_enabled always return true
// kdebug_interpose.c
#include <stdbool.h>
#include <stdint.h>
#include <dlfcn.h>
// Forward declare the original
extern bool kdebug_is_enabled(uint32_t debugid);
// Our replacement
@Yuki2718
Yuki2718 / gist:1c2171acaccb50fe05d030f0bf80fc81
Created September 23, 2025 05:10
ニコニ広告用DNRルール
---
action:
type: block
condition:
urlFilter: ||nicoad.nicovideo.jp^
---
//
// ContentView.swift
// MapModeButton-Demo
//
// Created by Seb Vidal on 30/07/2025.
//
import SwiftUI
struct ContentView: View {

(Summary generated by ChatGPT based on the automatic transcription. Transcript is attached to this Gist)

Q: What's the best approach to updating my app's UI for the new design?

A:

I think the best approach is to start from either the top down or the bottom up---however you perceive the hierarchy of your application. Focus on the big structural parts, since they tend to be most affected by the design and are often reflected in your code structure. Start there, then focus on the smaller elements.

Follow-up (Mohammed):