Sparkle icon indicating copy to clipboard operation
Sparkle copied to clipboard

Sparkle and SwiftUI 2.0

Open tillhainbach opened this issue 3 years ago • 4 comments

I'm currently building an app using SwiftUI 2.0 and was trying to get it to work with Sparkle. However, there wasn't that much material on the subject, so I stitched a sample repo and a step-by-step guide together from the pieces I found. ~~If anyone is interested: https://github.com/tillhainbach/SwiftUISparkleTestApp~~

This might need some changes/polishing by someone more familiar if the Sparkle 2.x-API but I would be happy update the guide if someone would review it. It might also be incorporated into the sparkle docs..

EDIT

Due to refactoring/development in the 2.x-branch some APIs around the SPUUserDriver and SPUUpdater have changed and my guid is not valid anymore. However, I am currently creating a combine-based wrapper for Sparkle, so it can be used more easily with SwiftUI, where I try to adapt to any changes in Sparkle's API. If anyone is interested: https://github.com/tillhainbach/Sparkly

tillhainbach avatar Mar 03 '21 21:03 tillhainbach

Thanks for the write up, I have wanted to but haven't had time to play with SwiftUI.

One note is that you may want to hook up menu item validation so the check for updates option is only enabled when the updater canCheckForUpdates property is true, however you do that in SwiftUI :).

The website is open source and can be contributed to. I guess we are lacking programatic / non-interface builder steps in general, which I feel is more important for Sparkle 2. We could also link to or make a small demonstration page for SwiftUI.

zorgiepoo avatar Mar 05 '21 07:03 zorgiepoo

Thanks for the hint. I created a little wrapper class around SPUStandardUserDriver which conforms to ObservableObject and SPUUserDriver protocol, so SwiftUI gets notified whenever "canCheckForUpdates" is set. Apparently, there is still a problem with the new Commands-API so I used "Frameworks Engineer"'s work-around from the developer-forum. I'll try to add some explanation in the readme and will create a PR in the docs-repo. For now, feel free to create an issue at my-repo if you have any questions.

tillhainbach avatar Mar 14 '21 12:03 tillhainbach

@tillhainbach I added and tested a simple sample (with some help from outside resources including your samples) using SwiftUI on Sparkle's documentation website - https://sparkle-project.org/documentation/programmatic-setup/ (I'm not that familiar with SwiftUI to be honest though)

zorgiepoo avatar Oct 25 '21 01:10 zorgiepoo

@tillhainbach I added and tested a simple sample (with some help from outside resources including your samples) using SwiftUI on Sparkle's documentation website - https://sparkle-project.org/documentation/programmatic-setup/ (I'm not that familiar with SwiftUI to be honest though)

looks fine. 👍🏻

tillhainbach avatar Oct 26 '21 11:10 tillhainbach

I updated the SwiftUI sample again, discussed here. Any further discussion on Sparkle & SwiftUI can be in that topic, or started as another discussion topic.

zorgiepoo avatar Sep 11 '22 23:09 zorgiepoo