mirror of
https://github.com/mas-cli/mas
synced 2024-11-29 06:50:39 +00:00
32 lines
995 B
Swift
32 lines
995 B
Swift
//
|
|
// SoftwareProduct.swift
|
|
// MasKit
|
|
//
|
|
// Created by Ben Chatelain on 12/27/18.
|
|
// Copyright © 2018 mas-cli. All rights reserved.
|
|
//
|
|
|
|
/// Protocol describing the members of CKSoftwareProduct used throughout MasKit.
|
|
public protocol SoftwareProduct {
|
|
var appName: String { get }
|
|
var bundleIdentifier: String { get set }
|
|
var bundlePath: String { get set }
|
|
var bundleVersion: String { get set }
|
|
var itemIdentifier: NSNumber { get set }
|
|
}
|
|
|
|
// MARK: - Equatable
|
|
extension SoftwareProduct {
|
|
static func == (lhs: Self, rhs: Self) -> Bool {
|
|
return lhs.appName == rhs.appName
|
|
&& lhs.bundleIdentifier == rhs.bundleIdentifier
|
|
&& lhs.bundlePath == rhs.bundlePath
|
|
&& lhs.bundleVersion == rhs.bundleVersion
|
|
&& lhs.itemIdentifier == rhs.itemIdentifier
|
|
}
|
|
|
|
/// Returns bundleIdentifier if appName is empty string.
|
|
var appNameOrBbundleIdentifier: String {
|
|
appName == "" ? bundleIdentifier : appName
|
|
}
|
|
}
|