A port of the Cocotron CoreData runtime for GNUstep on Linux (and compatible with Apple's CoreData API on macOS).
This project ports sources from the Cocotron project (MIT license). See LICENSE and LICENSE-Cocotron.txt for full license text and copyright holders.
NSFetchedResultsController follows the change tracking approach of
MRTFetchedResultsController
by Matteo Rattotti (MIT license), extended with the sectioning and index path based API of
Apple's NSFetchedResultsController.
CoreData/ - Framework source (headers + implementation)
Tests/ - Test suite (runs on GNUstep and macOS/Xcode)
Examples/EmployeeDirectory/ - SQLite based example application
GNUmakefile - Build script for GNUstep (framework.make)
Tests/GNUmakefile - Build script for the XCTest bundle
CoreDataTests.xcodeproj/ - Xcode project for macOS unit tests
Requires gnustep-make and GNUstep-base. The modern runtime (gnustep-2.0 / libobjc2) is recommended. See docs/GNUSTEP-SETUP.md for step-by-step instructions on building the full modern toolchain (libobjc2, gnustep-make, gnustep-base, gnustep-corebase, tools-xctest) from source.
. /usr/share/GNUstep/Makefiles/GNUstep.sh # source the GNUstep environment
make
sudo make installTests are built as an XCTest bundle and run with the xctest runner that ships with GNUstep.
cd Tests
make run-testsOr, step by step:
cd Tests
make
. $(gnustep-config --variable=GNUSTEP_MAKEFILES)/GNUstep.sh
xctest CoreDataTests.bundleOpen CoreDataTests.xcodeproj, select the CoreDataTests scheme, and run (⌘U).
The tests compile against Apple's built-in CoreData and XCTest frameworks — no custom shim needed.
Examples/EmployeeDirectory is a graphical (AppKit) application showing entity
inheritance, transient properties, validation, to-one/to-many/many-to-many relationships
and NSFetchedResultsController on top of the SQLite store, with one button per usage
scenario. It builds against this port on GNUstep and, via the bundled
EmployeeDirectory.xcodeproj, against Apple's CoreData/AppKit in Xcode; see
Examples/EmployeeDirectory/README.md.
- Framework sources are compiled with
-fno-objc-arc(manual reference counting, matching the original Cocotron style). The modern GNUstep runtime (libobjc2) is fully compatible with MRC. - Test sources (
Tests/CoreDataTests.m) are compiled with ARC (-fobjc-arc) and use the real<XCTest/XCTest.h>on both GNUstep and macOS. - Cocotron-specific macros (
NSUnimplementedMethod,NSInvalidAbstractInvocation) are shimmed inCoreData/CoreDataUtilities.h. isareferences replaced with[self class]/NSStringFromClass([self class])for portability.NSXMLDocumentand related Foundation XML classes are used directly (available in GNUstep-base).NSFetchedResultsControllerindex paths hold the section at position 0 and the row inside the section at position 1, matching Apple; build them with+[NSIndexPath indexPathWithIndexes:length:]sinceindexPathForRow:inSection:lives in UIKit/AppKit. Section information caching (thecacheNameargument) is not implemented.-[NSRelationshipDescription isToMany]matches Apple: a relationship is to-one exactly whenmaxCountis one (amaxCountof zero means unbounded, i.e. to-many);minCountonly expresses whether the relationship is mandatory.-[NSManagedObject valueForKey:]dispatches to a custom accessor implemented by the subclass (e.g. a computed transient property) before falling back to the modeled storage, matching Apple's key-value coding behavior.- When both AppKit and CoreData are imported on GNUstep, import AppKit first: GNUstep's AppKit
duplicates the
NSAttributeTypeconstants inNSPredicateEditorRowTemplate.h, and the CoreData headers step aside when that header was already included.

