Cocoa GUI interface for Darwin based Forth systems.
Goals:
-- Similar in usage as other interfaces in MacForth and Mach2. Think of things like NEW-XXX ADD.XXX etc.
-- No hacks, no shortcuts. Should survive OS upgrades! Follow their rules.
-- Try to stay close to ObjC names and procedures. Makes Apple examples easy to follow and to implement.
Inevitable is breaking the rules.
Note: Cocoa interface runs in CarbonMacForth(2008), iForth(2009) and SwiftForth(2010).
Current Mac OSX is Snow Leopard 10.6.8 and Lion 10.7.1
Current development is in SwiftForth.
Current target is ObjC runtime 2.
Examples shown with SwiftForth for OSX. Window named 'coco-sf' is the default I/O console and owned by Terminal.app running SwiftForth in a shell.
Interface to existing classes and methods:
COCOACLASS ( <classname> -- ) ( -- class ) register class with the runtime and return ref when executed
COCOAFUNC ( <selectorname> <parameters> -- ) ( n0 . . . ni -- n0 . . . ni nj ) register selector with the runtime and run as function when executed
Examples:
cocoaclass NSEvent
cocoafunc @mouseLocation ( -- point )
Note: -- the receiver is automaticly implied in the call setup
-- I use a leading @ character in method names
Create new classes:
NEW.CLASS ( parent <name> -- ) ( -- class )
ADD.CLASS ( class -- )
ADD.METHOD ( imp types name class -- )
ADD.CLASSMETHOD ( imp types name class -- )
ADD.IVAR ( type name class -- )
Example: buttons in NIB 'objects' created in Interfacebuilder are linked to methods in classes build with Forth.

Some of the most used spin offs, neccesities and conveniences for working with the Mac OS
FRAMEWORK ( <name> -- ) same as Library /System/Library/Frameworks/name.framework/name
2RET> ( n1 -- n1 n2 ) fetches the second returned parameter from call. See OSX Intel ABI.
*might find a better name for this
Examples:
framework Cocoa.framework
: @mouse ( f: -- x y ) nsevent @mouselocation 2ret> swap sf>f sf>f ;
Much used GUI items needing Cocoa
LOAD-FILE (including files using the file selector box) and cousins
EDIT-FILE LOAD-EDIT LOAD-SCRAP 
NEW.WINDOW ( <name> -- ) ( -- wptr4 )
ADD.WINDOW ( wptr4 -- )
. . . and the rest of the window related family. 
These words are similar to those found in MacForth and Mach2.
My stuff, won't bother or tire you with:
pet words, Quartz 2D, audio, video, IPC, GDB, schedulers, interrupts, Applescript etc.
Still some window usage examples:
Redirect output to window: ioregistry listing (similar to device tree in Openfirmware)
Showing photo's in a window, part of slideshow

Drawing Quartz 2D in borderless window 
Window for web access with WebKit
Window becomes console for Forth I/O 
Non Cocoa related examples:
A session with the resident GDB in a manner reminiscent of MacsBug

Controlling SuperCollider with OpenSoundControl 
Not used/implemented: standalone app without Terminal, programaticly creating menus, dialogs, controls, whatever other GUI widgets.
For now: I could implement some and do research on others, but I'm not using these. Time is limited.
You could use InterfaceBuilder supplying the actions with your cocoa-forth classes.
The main menu for coco-sf is implemented, but as exercise and demo.
Not in use. 
--- draw line here, done! ---