Reusable GUI components (a.k.a. controls) for touch-based (iOS) and mouse-based (macOS) SpriteKit projects.
The classes, while being SpriteKit node subclasses, should in principle mirror those in UIKit/AppKit (UIControl/NSControl, UIButton/NSButton), minus all the Cocoa/Objective-C-specific baggage (e.g., target-action design pattern, KVO/KVC, etc.) and adopt a more swifty design.
Subclasses SKSpriteNode and implements essential control logic: state, event handler registration, background texture/color per state. The implementation has platform-specific sections.
Subclasses Control, implements:
- Button-specific logic - state transitions driven by touch/mouse events, consistent with button-like behavior (select on touch-down, etc.)
- Button-specific appearance - configurable title label.
Add more Control subclasses in the future (e.g., switch, slider, etc.).
The included sample project Example/Example.xcodeproj
demonstrates the basic use of the Button control on both iOS and macOS SpriteKit apps.