SUStandardVersionComparator
Objective-C
@interface SUStandardVersionComparator : NSObject <SUVersionComparison>
Swift
class SUStandardVersionComparator : NSObject, SUVersionComparison
Sparkle’s default version comparator.
This comparator is adapted from MacPAD, by Kevin Ballard. It’s “dumb” in that it does essentially string comparison, in components split by character type.
-
Initializes a new instance of the standard version comparator.
Declaration
Objective-C
- (nonnull instancetype)init;
Swift
init()
-
A singleton instance of the comparator.
Declaration
Objective-C
@property (class, nonatomic, readonly) SUStandardVersionComparator *_Nonnull defaultComparator;
Swift
class var `default`: SUStandardVersionComparator { get }
-
Compares two version strings through textual analysis.
These version strings should be in the format of x, x.y, or x.y.z where each component is a number. For example, valid version strings include “1.5.3”, “500”, or “4000.1” These versions that are compared correspond to the
CFBundleVersion
values of the updates.Declaration
Objective-C
- (NSComparisonResult)compareVersion:(nonnull NSString *)versionA toVersion:(nonnull NSString *)versionB;
Swift
func compareVersion(_ versionA: String, toVersion versionB: String) -> ComparisonResult
Parameters
versionA
The first version string to compare.
versionB
The second version string to compare.
Return Value
A comparison result between
versionA
andversionB