This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String? { | |
/// This property is true on encountering one of "Y", "y", "T", "t", or a digit 1-9—the method ignores any trailing characters. | |
/// This property is false if the receiver doesn’t begin with a valid decimal text representation of a number. | |
/// | |
/// The property assumes a decimal representation and skips whitespace at the beginning of the string. | |
/// It also skips initial whitespace characters, or optional -/+ sign followed by zeroes. | |
var yN: Bool { if let self { NSString(string: self).boolValue } else { false } } | |
/// This property is true when it is empty (or nil) or when yN is true | |
var Yn: Bool { (self?.isEmpty ?? true) || yN } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// https://gist.github.com/Amzd/93f2e7b4712242ec4e17476146f528a2 | |
public struct Version: Codable { | |
public var major: UInt | |
public var minor: UInt | |
public var patch: UInt | |
public var identifier: String? | |
public var stringValue: String { | |
"\(major).\(minor).\(patch)" + (identifier.flatMap { "-\($0)" } ?? "") | |
} |
OlderNewer