No description
  • Assembly 33.1%
  • Rust 25.5%
  • C 18.1%
  • Swift 6.6%
  • Objective-C 6.4%
  • Other 10.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-21 18:00:01 +02:00
alert Use CoreFoundation C API's where possible 2026-08-21 18:00:01 +02:00
ios Use CoreFoundation C API's where possible 2026-08-21 18:00:01 +02:00
metal Use CoreFoundation C API's where possible 2026-08-21 18:00:01 +02:00
opengl Use CoreFoundation C API's where possible 2026-08-21 18:00:01 +02:00
portable-executable Use it also in portable-executable subproject 2026-08-14 17:33:04 +03:00
window Use CoreFoundation C API's where possible 2026-08-21 18:00:01 +02:00
.clang-format Add formatter configs 2026-08-14 11:37:50 +03:00
.editorconfig Add formatter configs 2026-08-14 11:37:50 +03:00
.gitignore Add entitlements to macOS apps 2026-06-05 13:14:31 +02:00
build-arm64.py Write custom code-signing Python build script 2026-08-14 17:25:15 +03:00
hello-arm64 Write custom code-signing Python build script 2026-08-14 17:25:15 +03:00
hello-arm64.s Write custom code-signing Python build script 2026-08-14 17:25:15 +03:00
hello-libc-arm64 Write custom code-signing Python build script 2026-08-14 17:25:15 +03:00
hello-libc-arm64.s Write custom code-signing Python build script 2026-08-14 17:25:15 +03:00
hello-libc-x86_64 Update asm objc alert example 2024-09-05 22:42:02 +02:00
hello-libc-x86_64.s Update asm objc alert example 2024-09-05 22:42:02 +02:00
hello-static-x86_64 Clean up arm64 assembly examples 2024-09-05 18:42:03 +02:00
hello-static-x86_64.s Clean up arm64 assembly examples 2024-09-05 18:42:03 +02:00
LICENSE Add entitlements to macOS apps 2026-06-05 13:14:31 +02:00
README.md Add 'modern' OpenGL example 2026-08-21 10:04:54 +02:00

macOS Assembly Examples

A collection of small macOS programs exploring Mach-O binaries, macOS Cocoa, iOS UIKit, and portable executables. The repository starts at hand-written assembly and then compares the same Apple platform APIs from C, Objective-C, Rust, Swift, and SwiftUI.

Repository layout

  • alert/ contains minimal macOS NSAlert applications in assembly, C, Objective-C, Rust, and Swift. The assembly version writes its complete x86_64 Mach-O executable directly with NASM instead of using the system linker.
  • window/ contains complete macOS window applications. The C version calls Cocoa through the Objective-C runtime, while the other versions use their language's usual Cocoa bindings. The Rust example also demonstrates a small hand-written Cocoa bridge.
  • metal/ contains graphics examples built with Apple's Metal API. The C, Objective-C, Rust, and Swift examples open a Cocoa window and render a rainbow triangle with vertex and fragment shaders.
  • opengl/ contains Cocoa C, Objective-C, Rust, and Swift examples that render the same rainbow triangle with an 'modern' OpenGL 4.1 Core context and GLSL shaders.
  • ios/ contains equivalent UIKit or SwiftUI applications for C, Objective-C, Rust, Swift, and SwiftUI. Their build scripts target an iOS simulator; selected examples can also use a local provisioning configuration to run on a physical device.
  • hello-*.s contains focused Mach-O experiments for arm64 and x86_64, including static-style binaries, dynamic libSystem calls, symbol tables, and ad-hoc code signing.
  • portable-executable/ builds polyglot native executables that select an ELF, Mach-O, or PE path at startup. It includes console hello-world and GUI alert examples.

Requirements

  • macOS with Xcode Command Line Tools
  • NASM for the assembly examples
  • Xcode's optional Metal Toolchain for the Metal examples
  • Rust and the required Apple targets for the Rust examples
  • A booted iOS Simulator for the simulator examples

Physical iOS devices additionally require a signing identity, provisioning profile, and device configuration. Copy provision.sh.example to provision.sh in an example that supports device deployment and fill in the local values. The resulting file is ignored by version control.