A cross-platform abstraction layer for Objective-C applications targeting macOS, iOS, Linux (GNUStep), and Windows (WinObjC).
SmallStep provides a unified API for common platform-specific operations, allowing you to write code once and run it on multiple platforms. It abstracts away platform differences while maintaining access to platform-specific features when needed.
- macOS (Cocoa/AppKit)
- iOS (UIKit)
- Linux (GNUStep)
- Windows (WinObjC)
- Detect current platform at runtime
- Platform-specific utilities and helpers
- CanvasView: Bitmap view with pencil/eraser tools, used by SmallPaint and SmallPhotoViewer. Optional; requires AppKit/gnustep-gui when linked.
- Unified file system API across all platforms
- Platform-appropriate directory handling:
- macOS/iOS: Uses standard Cocoa directories
- Linux: Respects XDG Base Directory Specification
- Windows: Uses Windows standard folders (Documents, AppData, LocalAppData)
- Cross-platform file operations
- Add SmallStep to your Xcode project
- Link against the SmallStep framework
- Import:
#import <SmallStep/SmallStep.h>
cd SmallStep
make
sudo make installThen in your GNUmakefile:
include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = YourApp
YourApp_OBJC_FILES = ...
YourApp_LIBRARIES_DEPEND_UPON = -lSmallStep
include $(GNUSTEP_MAKEFILES)/tool.make#import <SmallStep/SmallStep.h>
// Check platform
if ([SSPlatform isMacOS]) {
NSLog(@"Running on macOS");
} else if ([SSPlatform isiOS]) {
NSLog(@"Running on iOS");
} else if ([SSPlatform isLinux]) {
NSLog(@"Running on Linux");
} else if ([SSPlatform isWindows]) {
NSLog(@"Running on Windows");
}
// Get platform info
NSString *platformName = [SSPlatform platformName];
NSString *version = [SSPlatform platformVersion];#import <SmallStep/SmallStep.h>
SSFileSystem *fileSystem = [SSFileSystem sharedFileSystem];
// Get directories
NSString *documentsDir = [fileSystem documentsDirectory];
NSString *cacheDir = [fileSystem cacheDirectory];
NSString *appSupportDir = [fileSystem applicationSupportDirectory];
// File operations
BOOL exists = [fileSystem fileExistsAtPath:@"/path/to/file"];
NSData *data = [fileSystem readFileAtPath:@"/path/to/file" error:&error];
BOOL success = [fileSystem writeString:@"Hello" toPath:@"/path/to/file" error:&error];#if TARGET_OS_MAC && !TARGET_OS_IPHONE
#import <SmallStep/SSMacOSPlatform.h>
BOOL sandboxed = [SSMacOSPlatform isSandboxed];
NSString *appSupport = [SSMacOSPlatform macOSApplicationSupportPath];
#endif#if TARGET_OS_IPHONE
#import <SmallStep/SSiOSPlatform.h>
BOOL isExtension = [SSiOSPlatform isAppExtension];
NSString *docsDir = [SSiOSPlatform iOSDocumentsDirectory];
#endif#if defined(__GNUSTEP__) || defined(__linux__)
#import <SmallStep/SSLinuxPlatform.h>
NSString *xdgData = [SSLinuxPlatform xdgDataHome];
NSString *xdgConfig = [SSLinuxPlatform xdgConfigHome];
NSString *xdgCache = [SSLinuxPlatform xdgCacheHome];
#endif#if defined(WINOBJC) || defined(_WIN32)
#import <SmallStep/SSWindowsPlatform.h>
NSString *documents = [SSWindowsPlatform windowsDocumentsPath];
NSString *localAppData = [SSWindowsPlatform windowsLocalAppDataPath];
NSString *appData = [SSWindowsPlatform windowsAppDataPath];
NSString *temp = [SSWindowsPlatform windowsTempPath];
#endifSmallStep/
├── Core/ # Core platform abstraction
│ ├── SSPlatform.h/m # Platform detection
│ ├── SSFileSystem.h/m # File system operations
│ ├── CanvasView.h/m # Bitmap canvas (pencil/eraser; AppKit)
│ └── SmallStep.h # Main header
└── Platform/ # Platform-specific implementations
├── macOS/ # macOS-specific code
├── iOS/ # iOS-specific code
└── Linux/ # Linux/GNUStep-specific code
- Unified API: Same interface across all platforms
- Platform Awareness: Detect and adapt to platform capabilities
- Standards Compliance: Follow platform conventions (XDG on Linux, Cocoa on Apple platforms)
- Minimal Dependencies: Only Foundation framework required
- Lightweight: Small footprint, fast performance
- Open
SmallStep.xcodeproj(create if needed) - Select target platform
- Build framework
makeBuild using Visual Studio with WinObjC SDK integration.
See LICENSE file for details.
When adding platform-specific features:
- Add core abstraction in
Core/ - Implement platform-specific code in
Platform/[platform]/ - Update documentation
- Add tests if applicable