This project is an Objective-C template, ready to be used as a starting point for any Objective-C project. It uses only the libobjc runtime and is designed for portability and extensibility.
- A reusable custom root class,
Root, which provides the foundation for any Objective-C project (object allocation, initialization, manual reference counting, and class name introspection). - Sample subclasses:
Parent(basic methods) andChild(inherits fromParent, overrides methods, demonstratessuper). - A
main.mfile that demonstrates usage.
The template is simple, portable, and enables Objective-C without the need for heavier libraries like Foundation or GNUstep.
The template now includes reusable low-level abstractions that are useful beyond game projects:
String: Minimal immutable string wrapper with C-string interop (fromCString,initWithCString, comparisons, lowercase conversion).List: Dynamic array ofidobjects with manual ownership semantics and predictable power-of-two capacity growth.Dictionary: String-keyed hash table (String *keys,idvalues) with open addressing and manual ownership semantics.
These are intentionally lightweight and runtime-only (libobjc), with no Foundation dependency.
- Compiler: GCC with Objective-C support (
gobjc). - Runtime Library:
libobjc(GNU Objective-C runtime). - Development Environment: Linux-based system with
makeinstalled.
- No use of high-level frameworks like Foundation or GNUstep.
- Object creation and management are handled using
libobjcruntime APIs. - The project is designed to be portable and minimal.
src/Root.h/src/Root.m: Defines and implements the custom root class (Root).src/Parent.h/src/Parent.m: Sample subclass (Parent).src/Child.h/src/Child.m: Sample subclass (Child).src/String.h/src/String.m: Generic minimal string abstraction.src/List.h/src/List.m: Generic dynamic list abstraction.src/Dictionary.h/src/Dictionary.m: Generic hash-table dictionary abstraction.src/main.m: Entry point for the program.Makefile: Build, test, and run instructions.tests/: Unit tests (see below).
Unit tests are provided for each class in the tests/ directory. Each test file (e.g., tests/root.m, tests/parent.m, tests/child.m, tests/string.m, tests/list.m, tests/dictionary.m) is a standalone program with its own main() function and assertions. Run all tests with:
make testThis will build and execute each test binary independently. All tests use only standard C and the same minimal runtime as the main code.
- Open a terminal and navigate to the project directory.
- Run the following command to build the project:
make
After building, run the program with:
make runTo remove the compiled binary, run:
make clean