Sparkly is a light-weight, combine-based wrapper around the Sparkle auto-update framework. It's main goal is to abstract away the complexity of the framework, make it easier to use with SwiftUI and to increase the ability for unit-testing (e.g. ease of mocking sparkle).
Sparkly provides a simple interface struct called UpdaterClient
. This client is responsible for routing actions
to and events from Sparkle. All actions and events are modelled as enums with associated values.
ViewModels, or your preferred flavour, can send actions to sparkle using the UpdaterClient.send(_:)
closure and subscribe to updater events on the UpdaterClient.publisher
.
NOTE:
Sparkly
is currently under development. Not all actions and events are implemented and the interface may change. However, all of theSPUUserDriver
methods are wrapped in events and it is possible to implement a ui-based update check (see SparklyExample)
NOTE:
Sparkly
uses Sparkle 2 which is currently still in beta!
See the example app in SparklyExample. It's a SwiftUI-based mac app that uses Sparkly to interact with Sparkle. Also have a look at the unit tests which show case how easy you can mock Sparkl(y|e) and get a consistent deterministic behaviour during testing and development without having to mess around with XCUITests or manually setting user defaults.
Use SwiftPackageManager. Add the following to your dependencies.
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(url: "https://github.com/tillhainbach/Sparkly.git", .branch("main"))
],
Sparkly has a dependency on Sparkle version 2.0.0-beta.4 which is the first version that bundles the XPC-services inside the Sparkle framework. For enabling these XPC-services see additional setup
✅ SPUUserDriver: all methods emit events.
⚠️ SPUUpdater
UpdaterClient.Action.startUpdater
UpdaterClient.Action.checkForUpdates
UpdaterClient.Event.canCheckForUpdates(_:)
UpdaterClient.Action.setHttpHeaders(_:)
❌ SPUUpdaterDelegate: You may pass a delegate to UpdaterClient.live(hostBundle:applicationBundle:delegate:)
I most likely will not wrap these methods/properties:
UserDefaults
UserDefaults
UserDefaults
UserDefaults
UserDefaults
, Info.plist
or -[SPUUpdaterDelegate feedURLStringForUpdater:]
Sparkly is licensed under the MIT license. See LICENSE for further details.
link |
Stars: 9 |
Last commit: 2 years ago |
This release of the test app is only for ci. Do not use!
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics