GradientEditor v1.1.0
GradientEditor v1.1.0 - Native Framework Support
Overview
Version 1.1.0 brings native framework support to GradientEditor, making the library accessible to UIKit and AppKit developers without requiring SwiftUI knowledge. This release maintains 100%
backward compatibility with existing SwiftUI integrations while expanding platform support.
What's New
UIKit Support (iOS & visionOS)
GradientEditor now provides a native UIKit wrapper for seamless integration into UIKit-based applications:
- GradientEditorViewController - Drop-in view controller for UIKit apps
- GradientEditorDelegate protocol for callback-based integration
- Completion handler and delegate patterns for flexible integration
- Native navigation bar with Cancel/Save buttons
- Convenience presentation methods (modal, push)
Example Usage:
let editor = GradientEditorViewController(scheme: myScheme) { result in
switch result {
case .saved(let scheme):
// Handle saved gradient
case .cancelled:
// Handle cancellation
}
}
present(editor, animated: true)
AppKit Support (macOS)
Full AppKit support brings GradientEditor to native macOS applications:
- GradientEditorViewController for AppKit (separate from UIKit version)
- GradientEditorDelegate protocol for macOS
- macOS-native button layout and styling
- Convenience presentation methods (sheet, modal window)
Example Usage:
let editor = AppKitGradientEditorViewController(scheme: myScheme) { result in
switch result {
case .saved(let scheme):
// Handle saved gradient
case .cancelled:
// Handle cancellation
}
}
presentAsSheet(editor)
Technical Details
- Implementation: Both wrappers use UIHostingController/NSHostingController to wrap SwiftUI views
- Concurrency: Proper @mainactor isolation and @sendable compliance throughout
- Platform Detection: Platform-specific conditional compilation (#if canImport(UIKit/AppKit))
- Flexibility: Dual callback patterns (completion handlers + delegates) for maximum flexibility
- Swift 6: Full strict concurrency mode compliance
Testing
- 14 new tests added for UIKit and AppKit wrappers
- 144 total tests (up from 130), maintaining 100% pass rate
- Comprehensive coverage of initialization, delegate callbacks, and completion handlers
Documentation
- Updated README.md with UIKit and AppKit usage examples
- Updated TechnicalDesign.md with platform support documentation
- Complete DocC documentation for all new public APIs
Files Added
- Sources/GradientEditor/UIKit/GradientEditorDelegate.swift
- Sources/GradientEditor/UIKit/GradientEditorViewController.swift
- Sources/GradientEditor/AppKit/AppKitGradientEditorDelegate.swift
- Sources/GradientEditor/AppKit/AppKitGradientEditorViewController.swift
- Tests/GradientEditorTests/UIKitTests.swift
- Tests/GradientEditorTests/AppKitTests.swift
Compatibility
- Minimum Requirements: iOS 18+, visionOS 2+, macOS 15+
- Swift Version: 6.0+
Full Changelog: v1.0.0...v1.1.0