Skip to content

Instantly share code, notes, and snippets.

View Mx-Iris's full-sized avatar

Mx-Iris Mx-Iris

View GitHub Profile
@Kyle-Ye
Kyle-Ye / CAHostingLayer.md
Last active August 6, 2026 06:28
Using CAHostingLayer in SwiftUI — access SwiftUI's SPI CALayer without Apple internal SDK

Using CAHostingLayer in SwiftUI

Background

SwiftUI provides more than just UIHostingController / _UIHostingView (iOS) and NSHostingController / NSHostingView (macOS) for embedding SwiftUI views into UIKit/AppKit.

Starting from iOS 18.0 / macOS 15.0, SwiftUI also offers CAHostingLayer<Content: View> — a CALayer subclass that can host SwiftUI content directly at the layer level. This API is currently marked as SPI (@_spi(ForUIKitOnly) / @_spi(ForAppKitOnly)) and is used internally by UIKit, AppKit, and WebKit.

Accessing CAHostingLayer without Apple Internal SDK

@iSapozhnik
iSapozhnik / AGENTS.md
Created February 6, 2026 09:13
Common CLI tools for Agentic Coding

Agent Guidelines

Token-efficient build output

  • Always pipe Xcode/Swift build logs through xcsift to keep transcripts small and structured.
  • Remember to redirect stderr to stdout (2>&1) so xcsift sees the full log stream.

Common commands

  • Basic build: xcodebuild -project <app_name>.xcodeproj -scheme <scheme_name> -configuration Debug build 2>&1 | xcsift
  • Run tests + coverage: xcodebuild test -enableCodeCoverage YES 2>&1 | xcsift --coverage
  • Show warnings explicitly: xcodebuild build 2>&1 | xcsift --print-warnings
extension StringProtocol {
/// str[NSRange(location:0, length: 9)]
subscript(_ range: NSRange) -> SubSequence {
guard let stringRange = Range<String.Index>(range, in: self) else {
fatalError("String index is out of range")
}
return self[stringRange]
}
@Kyle-Ye
Kyle-Ye / XcodeLLM.md
Last active September 19, 2025 01:31
Enable XcodeLLM for ChinaSKU Mac on macOS 15 Beta 1

Warning

The following guide need to disable SIP to work.

Please confirm the risk of disabling the SIP by yourself.

Another solution which does not require disabling SIP is currently under investigation.

Step 0

Reboot into Recovery OS + Disable SIP

@gabe565
gabe565 / change-arc-icon.md
Last active August 16, 2026 20:38
Change Arc Browser Icon

Change Arc Browser Icon

arc

A collection of commands that change the Arc Browser icon on macOS.

Commands

Theme Command
Candy Arc defaults write company.thebrowser.Browser currentAppIconName candy
@0xdevalias
0xdevalias / reverse-engineering-macos.md
Last active August 18, 2026 15:25
Some notes, tools, and techniques for reverse engineering macOS binaries
@kconner
kconner / macOS Internals.md
Last active September 9, 2026 13:34
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@vocaeq
vocaeq / inject.c
Last active April 3, 2026 13:34 — forked from knightsc/inject.c
An example of how to inject code to call dlopen and load a dylib into a remote mach task. Tested on 12.5 M1 Pro.
#include <dlfcn.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <mach/mach.h>
#include <mach/error.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/sysctl.h>
#include <sys/mman.h>
@mikeyh
mikeyh / SMJobBlessUtil-python3.py
Last active July 12, 2025 03:18
SMJobBlessUtil.py for Python3 / Xcode 13.3 / macOS Monterey 12.3 (with workaround for otool arm64 weirdness)
#! /usr/bin/python3
#
# File: SMJobBlessUtil.py
#
# Contains: Tool for checking and correcting apps that use SMJobBless.
#
# Written by: DTS
#
# Copyright: Copyright (c) 2012 Apple Inc. All Rights Reserved.
#
@rannn505
rannn505 / common.itermkeymap
Created January 26, 2022 23:34
Common keyboard shortcuts for iTerm2
{
"Key Mappings": {
"0xf702-0x300000-0x7b": {
"Label": "Cursor Start ⌘←",
"Action": 11,
"Text": "0x01"
},
"0xf703-0x300000-0x7c": {
"Label": "Cursor End ⌘→",
"Action": 11,