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
@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 {
@kconner
kconner / macOS Internals.md
Last active October 21, 2025 15:03
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:

@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")
}
@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
@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)
@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",
# Thanks to here https://stackoverflow.com/questions/13861658/is-it-possible-to-search-though-all-xcodes-logs
EXT=".xcactivitylog"
for LOG in *.xcactivitylog; do
NAME=`basename $LOG $EXT`
gunzip -c -S $EXT "${NAME}${EXT}" > "${NAME}.log"
done
@lattner
lattner / TaskConcurrencyManifesto.md
Last active October 27, 2025 08:04
Swift Concurrency Manifesto
@lattner
lattner / async_swift_proposal.md
Last active June 7, 2025 23:55 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

@regexident
regexident / AnyDiffable.swift
Created March 17, 2017 10:26 — forked from ollieatkinson/AnyDiffable.swift
Implementation of Paul Heckel's Diff Algorithm in Swift 3
public protocol Diffable: Hashable {
var primaryKeyValue: String { get }
}
public struct AnyDiffable: Diffable {
private let _primaryKeyValue: () -> String