objc-js is an Objective-C bridge for Node.js. This is a fork of nobjc by Noah Gregory.
- Node.js / Bun
- Xcode Command Line Tools (Run
xcode-select --installto install) pkg-configfrom Homebrew (Runbrew install pkgconfto install)
Note
Why are these prerequisites required?
These are required to rebuild the native code for your system.
npm install objc-jsbun add objc-js
# and `bun pm trust -a` to run the rebuild if neededThe documentation is organized into several guides:
- Basic Usage - Getting started with loading frameworks and calling methods
- Subclassing Objective-C Classes - Creating and subclassing Objective-C classes from JavaScript
- Protocol Implementation - Creating delegate objects that implement protocols
- API Reference - Complete API documentation for all classes and functions
import { NobjcLibrary } from "objc-js";
// Load a framework
const foundation = new NobjcLibrary("/System/Library/Frameworks/Foundation.framework/Foundation");
// Get a class and call methods
const NSString = foundation["NSString"];
const str = NSString.stringWithUTF8String$("Hello, World!");
console.log(str.toString());For more examples and detailed guides, see the documentation.