SmallStep is a cross-platform abstraction layer designed to provide a unified API for common platform-specific operations across macOS, iOS, Linux (GNUStep), and Windows (WinObjC).
- Unified API: Same interface across all platforms
- Platform Awareness: Automatically adapts to platform capabilities
- Standards Compliance: Follows platform conventions (XDG on Linux, Cocoa on Apple)
- Minimal Dependencies: Only Foundation framework required
- Lightweight: Small footprint, fast performance
SmallStep/
├── Core/ # Core platform abstraction
│ ├── SSPlatform.h/m # Platform detection
│ ├── SSFileSystem.h/m # File system operations
│ └── SmallStep.h # Main framework header
└── Platform/ # Platform-specific implementations
├── macOS/
│ └── SSMacOSPlatform.h/m # macOS-specific utilities
├── iOS/
│ └── SSiOSPlatform.h/m # iOS-specific utilities
├── Linux/
│ └── SSLinuxPlatform.h/m # Linux/GNUStep-specific utilities
└── Windows/
└── SSWindowsPlatform.h/m # Windows/WinObjC-specific utilities
Platform detection and information:
- Runtime platform detection
- Platform name and version
- Platform-specific checks
Unified file system operations:
- Documents directory (platform-appropriate)
- Cache directory (XDG-compliant on Linux)
- Application support directory
- File operations (read, write, delete, list)
Each platform has its own module for platform-specific features:
- macOS: Sandbox detection, AppKit-specific paths
- iOS: App extension detection, shared containers
- Linux: XDG Base Directory support
- Windows: Windows-specific folder paths (Documents, AppData, LocalAppData)
- Uses standard Cocoa directory APIs
NSSearchPathForDirectoriesInDomainsfor standard directories- Application Support directory includes bundle identifier
- Respects XDG Base Directory Specification
- Falls back to standard locations if XDG variables not set
- Creates directories if they don't exist
// 1. Detect platform
if ([SSPlatform isMacOS]) {
// macOS-specific code
}
// 2. Use unified API
SSFileSystem *fs = [SSFileSystem sharedFileSystem];
NSString *docs = [fs documentsDirectory];
// 3. Access platform-specific features when needed
#if TARGET_OS_MAC && !TARGET_OS_IPHONE
BOOL sandboxed = [SSMacOSPlatform isSandboxed];
#endifSmallStep is designed to be extended:
- New Platforms: Add platform detection and implementation
- New Features: Add new unified APIs in Core/
- Platform-Specific: Add platform modules as needed
- macOS/iOS: Framework (Xcode or CocoaPods)
- Linux: Library (GNUStep makefiles)
- Windows: Framework/Library (WinObjC/Visual Studio)
Platform-specific code is conditionally compiled, allowing:
- Single codebase for all platforms
- Platform-specific optimizations
- Easy testing on each platform