SPUStandardUpdaterController

Objective-C

@interface SPUStandardUpdaterController : NSObject {
  id<SPUUpdaterDelegate> updaterDelegate;
  id<SPUStandardUserDriverDelegate> userDriverDelegate;
}

Swift

class SPUStandardUpdaterController : NSObject

A controller class that instantiates a SPUUpdater and allows binding UI to its updater settings.

This class can be instantiated in a nib or created programmatically using -initWithUpdaterDelegate:userDriverDelegate: or -initWithStartingUpdater:updaterDelegate:userDriverDelegate:.

The controller’s updater targets the application’s main bundle and uses Sparkle’s standard user interface. Typically, this class is used by sticking it as a custom NSObject subclass in an Interface Builder nib (probably in MainMenu) but it works well programmatically too.

The controller creates an SPUUpdater instance using a SPUStandardUserDriver and allows hooking up the check for updates action and handling menu item validation. It also allows hooking up the updater’s and user driver’s delegates.

If you need more control over what bundle you want to update, or you want to provide a custom user interface (via SPUUserDriver), please use SPUUpdater directly instead.

  • Unavailable

    Interface builder outlet for the updater’s delegate.

    Declaration

    Objective-C

    id<SPUUpdaterDelegate> updaterDelegate
  • Unavailable

    Interface builder outlet for the user driver’s delegate.

    Declaration

    Objective-C

    id<SPUStandardUserDriverDelegate> userDriverDelegate
  • Accessible property for the updater. Some properties on the updater can be binded via KVO

    When instantiated from a nib, don’t perform update checks before the application has finished launching in a MainMenu nib (i.e applicationDidFinishLaunching:) or before the corresponding window/view controller has been loaded (i.e, windowDidLoad or viewDidLoad). The updater is not guaranteed to be started yet before these points.

    Declaration

    Objective-C

    @property (nonatomic, readonly) SPUUpdater *_Nonnull updater;

    Swift

    var updater: SPUUpdater { get }
  • Accessible property for the updater’s user driver.

    Declaration

    Objective-C

    @property (nonatomic, readonly) SPUStandardUserDriver *_Nonnull userDriver;

    Swift

    var userDriver: SPUStandardUserDriver { get }
  • Unavailable

    Create a new SPUStandardUpdaterController from a nib.

    You cannot call this initializer directly. You must instantiate a SPUStandardUpdaterController inside of a nib (typically the MainMenu nib) to use it.

    To create a SPUStandardUpdaterController programmatically, use -initWithUpdaterDelegate:userDriverDelegate: or -initWithStartingUpdater:updaterDelegate:userDriverDelegate: instead.

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Create a new SPUStandardUpdaterController programmatically.

    The updater is started automatically. See -startUpdater for more information.

    Declaration

    Objective-C

    - (nonnull instancetype)
        initWithUpdaterDelegate:(nullable id<SPUUpdaterDelegate>)updaterDelegate
             userDriverDelegate:
                 (nullable id<SPUStandardUserDriverDelegate>)userDriverDelegate;

    Swift

    init(updaterDelegate: SPUUpdaterDelegate?, userDriverDelegate: SPUStandardUserDriverDelegate?)
  • Create a new SPUStandardUpdaterController programmatically allowing you to specify whether or not to start the updater immediately.

    You can specify whether or not you want to start the updater immediately. If you do not start the updater, you must invoke -startUpdater at a later time to start it.

    Declaration

    Objective-C

    - (nonnull instancetype)
        initWithStartingUpdater:(BOOL)startUpdater
                updaterDelegate:(nullable id<SPUUpdaterDelegate>)updaterDelegate
             userDriverDelegate:
                 (nullable id<SPUStandardUserDriverDelegate>)userDriverDelegate;

    Swift

    init(startingUpdater startUpdater: Bool, updaterDelegate: SPUUpdaterDelegate?, userDriverDelegate: SPUStandardUserDriverDelegate?)
  • Starts the updater if it has not already been started.

    You should only call this method yourself if you opted out of starting the updater on initialization. Hence, do not call this yourself if you are instantiating this controller from a nib.

    This invokes -[SPUUpdater startUpdater:]. If the application is misconfigured with Sparkle, an error is logged and an alert is shown to the user (after a few seconds) to contact the developer. If you want more control over this behavior, you can create your own SPUUpdater instead of using SPUStandardUpdaterController.

    Declaration

    Objective-C

    - (void)startUpdater;

    Swift

    func startUpdater()
  • Explicitly checks for updates and displays a progress dialog while doing so.

    This method is meant for a main menu item. Connect any NSMenuItem to this action in Interface Builder or programmatically, and Sparkle will check for updates and report back its findings verbosely when it is invoked.

    When the target/action of the menu item is set to this controller and this method, this controller also handles enabling/disabling the menu item by checking -[SPUUpdater canCheckForUpdates]

    This action checks updates by invoking -[SPUUpdater checkForUpdates]

    Declaration

    Objective-C

    - (void)checkForUpdates:(nullable id)sender;

    Swift

    @IBAction func checkForUpdates(_ sender: Any?)