Swiftpack.co - Package - magesteve/SlamKit

SlamKit - Fast Closure based Swift Package for Cross-platform OSes.


Like many things in life, Slam started as one thing and morphed into another.

At first, Slam was a demonstration of what I like to call "Closure Programming". I believe that Closures are the next step in Object-Oriented Programming. While they will not replace subclassing, they are a more efficient way to connect standard functionality (especially user interface) with custom code. Rather than continually overriding functions, closures can be defined for the function to invoke—all with little Interface Builder use. Thus Closures are a better tool for wiring an interface than the target-action pattern used by Cocoa & Cocoa Touch. Likewise, the Delegate & Data Source design patterns can be implemented easier with Closures.

So Slam became a Lab for developing Closure based user interface Elements. Elements that soon became useful to me in creating real-world apps for the Mac, iPhone, iPad, and Apple TV.

Slam name and first motto reflect this origin: "Slam for Fast Closure app development."

Once enough elements were created, Slam started needing other functionality to implement real MacOS & iOS apps. Channeling the spirit of the original MacApp framework, Slam became a collection of advanced Mac & iOS object classes. The concept of a Task was implemented, and patterns were written to connect elements that launch tasks (Menu items, Toolbar items, Buttons) with the controller code that defined these tasks (App controllers, View controllers, Document controllers). Soon we had classes that implement cut/copy functionality, menu/toolbar task handling, scripting & bookmarking, and even undoable tasks. The more that Slam was used, the more abilities the Framework developed, the more features the apps had, all while shrinking the actual new code for an app.

At that point, it became apparent many of the elements and tasks were no longer OS-specific. While the implementation of a button, menu item, table list, or view controller is different on a Mac vs. an iPhone, interaction with these elements was done in a comprehensive manner using non-OS specific protocols and closures. The app-specific functionality of controllers could be taken out of the NSViewControllers & UIViewControllers and put into abstract Protocols. Thus the division between SlamKit (abstract protocols & data structures) and SlamMacOSKit (Mac-based User Interfaces that use the protocols). The concept of Tasks, user interface independent operations, developed. SlamKit had reached its latest morph into a Swift Package.

I do not know what the next morph for SlamKit will be, but I am sure there will be one. And it will be interesting.


Since SlamKit is a Swift Package, the IDE or Make file of a project must reference SlamKit's repository:


To clone SlamKit, the following Terminal command should be used:

% git clone https://github.com/magesteve/SlamKit

Platform Specific Usage

By itself, SlamKit does not provide any user interface support. To extend the power of SlamKit, each OS platform should have an associated Swift Package. Currently, SwiftMacOSKit is the only available package, providing standard MacOS user interfaces with closure support.

SlamMacOSKit Repository: https://github.com/magesteve/SlamMacOSKit

The SlamMacOSKit is a Swift Package with dependencies on the SlamKit package. If a developer adds SlamMacOSKit package to his project, the SlamKit package will also be installed.


All public classes, protocols, properties & functions have inline documentation (DOxygen style). Further explanation of the Framework, refer to the SlamMacOSKit repository or any example projects.


Slam is targeted for the last versions of the Swift programming languages, Swift 5.2.


1.0.0 Initial Release 1.0.1 Updated Documentation. 1.0.2 Updates to Protocols and TypeAliases. 1.0.3 More Updates to Protocols and TypeAliases.

Steve Sheets, magesteve@mac.com

Originally from Silicon Valley, Steve has been embedded in the software industry for over 35 years. As an expert in user interface and design, he started developer desktop applications for companies like Apple and AOL, moved into mobile development, and is now working in the virtual reality and Augment Reality space. He has taught Objective-C & Swift development classes (MoDev, Learning Tree), as well as given talk on variety of developer topics (DC Mac Dev group, Capital One Swift Conference). He is an avid game player, swordsman and an occasional game designer.


SlamKit is available under the MIT license. The intent of the project is to be always Open Source and freely available. Please keep me informed of any interesting uses!


Stars: 3


v1.0.3 - 2020-08-04T21:50:27

Update to protocols and typealiases

v1.0.2 - 2020-07-31T21:43:48

Extension typealias and protocols

v1.0.1 - 2020-07-24T02:44:34

Update to Documentation

v1.0.0 - 2020-07-23T04:49:41

Initial Release