Skip to content

Instantly share code, notes, and snippets.

View Alexander-Ignition's full-sized avatar
:atom:

Alexander Ignition Alexander-Ignition

:atom:
View GitHub Profile
@cockscomb
cockscomb / swift-format.rb
Created December 18, 2019 22:17
Homebrew Formula of apple/swift-format
class SwiftFormat < Formula
desc "Formatting technology for Swift source code"
homepage "https://github.com/apple/swift-format"
url "https://github.com/apple/swift-format.git", :branch => "swift-5.1-branch"
head "https://github.com/apple/swift-format.git"
depends_on :xcode => ["11.0", :build]
def install
system "swift", "build", "--configuration", "release",
@ddddxxx
ddddxxx / KeyPath+fieldName.swift
Last active April 28, 2023 10:24
KeyPath Introspection
// This file is based largely on the Runtime package - https://github.com/wickwirew/Runtime
extension KeyPath {
var fieldName: String? {
guard let offset = MemoryLayout<Root>.offset(of: self) else {
return nil
}
let typePtr = unsafeBitCast(Root.self, to: UnsafeMutableRawPointer.self)
let metadata = typePtr.assumingMemoryBound(to: StructMetadata.self)
@nikolay-n
nikolay-n / 00_only_vars.txt
Last active August 22, 2024 06:54
Dtrace of libsystem getenv
ACTIVITY_LOG_STDERR
AEConvertBookmarksToAliasesHack
AEDebugFull
AEDebugReceives
AEDebugSends
ALLOWED_GPU_IDS
APPLE_FRAMEWORKS_ROOT
ARCH
ASL_DISABLE
ASL_QUOTA_DISABLED
@Catfish-Man
Catfish-Man / manystrings.swift
Created July 12, 2022 03:00
How many different kinds of NSString can we generate with the same code?
import Foundation
func examine(_ str: String) {
print("\"\(str)\"")
print("bridges as: \(type(of: str as NSString))")
str.withCString {
print("inits an NSString as: \(type(of: NSString(cString: $0, encoding: String.Encoding.ascii.rawValue)!))")
}
print("\n")
}
@kconner
kconner / macOS Internals.md
Last active October 31, 2025 14:00
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:

@bfahey
bfahey / DebuggingOverlay.swift
Created April 5, 2024 16:56
Debug your app with Apple's private UIDebuggingInformationOverlay. Supports iOS 13-17+.
import UIKit
import ObjectiveC.runtime
/// An enum that displays UIKitCore's `UIDebuggingInformationOverlay`.
enum DebuggingOverlay {
/// Shows the `UIDebuggingInformationOverlay`.
@available(iOS 13, *)
static func show() {
struct Once {