ValidationRule
An EUDCC
ValidationRule
-
The predicate typealias
Declaration
Swift
public typealias Predicate = (EUDCC) -> Bool
-
The CompareAgainst enumeration
See moreDeclaration
Swift
enum CompareAgainst<Value>
-
Compare value of a given KeyPath to another value using an operator
Declaration
Swift
static func compare<Value>( value: CompareAgainst<Value>, to compareAgainstValue: CompareAgainst<Value>, operator: @escaping (Value, Value) -> Bool, tag: Tag = .init() ) -> Self
Parameters
keyPath
The KeyPath to the value of the EUDCC
compareAgainstValue
The value to compare against
operator
The operator used for comparison
tag
The Tag. Default value
.init()
Return Value
A ValidationRule
-
The CompareAgainstDate Parameter
See moreDeclaration
Swift
struct CompareAgainstDate
-
Compare two Dates using a given operator
Declaration
Swift
static func compare( lhsDate: CompareAgainstDate, rhsDate: CompareAgainstDate, operator: @escaping (Date, Date) -> Bool, using calendar: Calendar = .current, tag: Tag = .init() ) -> Self
Parameters
lhsDate
The left-hand-side CompareAgainstDate
rhsDate
The right-hand-side CompareAgainstDate
operator
The operator closure
calendar
The Calendar. Default value
.current
tag
The Tag. Default value
.init()
-
Returns a ValidationRule where two given ValidationRules results will be compared to equality
Declaration
Swift
static func == ( lhs: Self, rhs: Self ) -> Self
Parameters
lhs
The left-hand side of the operation
rhs
The right-hand side of the operation
-
Returns a ValidationRule where two given ValidationRule results will be compared to unequality
Declaration
Swift
static func != ( lhs: Self, rhs: Self ) -> Self
Parameters
lhs
The left-hand side of the operation
rhs
The right-hand side of the operation
-
Constant ValidationRule that will always return the given Bool result value
Declaration
Swift
static func constant( _ result: Bool ) -> Self
Parameters
result
The Bool resul value
-
Has vaccination content ValidationRule
Declaration
Swift
static var isVaccination: `Self` { get }
-
Has test content ValidationRule
Declaration
Swift
static var isTest: `Self` { get }
-
Has recover content ValidationRule
Declaration
Swift
static var isRecovery: `Self` { get }
-
Has received all vaccination doses
Declaration
Swift
static var isVaccinationComplete: `Self` { get }
-
Vaccination can be considered as fully immunized
Declaration
Swift
static func isFullyImmunized( minimumDaysPast: Int = 15, using calendar: Calendar = .current ) -> Self
Parameters
minimumDaysPast
The amount of minimum days past since the last vaccination. Default value
15
calendar
The Calendar that should be used. Default value
.current
-
Validates if the vaccination expired by comparing if the current Date is greater than the date of vaccination added by the
maximumDaysSinceVaccinationDate
Declaration
Swift
static func isVaccinationExpired( maximumDaysSinceVaccinationDate: Int = 365, using calendar: Calendar = .current ) -> Self
Parameters
maximumDaysSinceVaccinationDate
The maximum days since date of vaccination. Default value
365
calendar
The Calendar. Default value
.current
-
Validates if EUDCC contains a Vaccination and the
VaccineMedicinalProduct
value is contained in theWellKnownValue
enumerationDeclaration
Swift
static var isWellKnownVaccineMedicinalProduct: `Self` { get }
-
Validates if the
VaccineMedicinalProduct
is contained in the given Sequence of VaccineMedicinalProduct WellKnownValuesDeclaration
Swift
static func vaccineMedicinalProductIsOneOf<Vaccines: Sequence>( _ validVaccineMedicinalProducts: Vaccines ) -> Self where Vaccines.Element == EUDCC.Vaccination.VaccineMedicinalProduct.WellKnownValue
Parameters
validVaccineMedicinalProducts
The VaccineMedicinalProduct WellKnownValue Sequence
-
TestResult of Test is positive
Declaration
Swift
static var isTestedPositive: `Self` { get }
-
TestResult of Test is negative
Declaration
Swift
static var isTestedNegative: `Self` { get }
-
Is Test valid
Declaration
Parameters
maximumHoursPast
The maximum hours past since date of sample collection. Default value
PCR: 72 | RAPID: 48
calendar
The Calendar that should be used. Default value
.current
-
Is Recovery valid
Declaration
Swift
static var isRecoveryValid: `Self` { get }
-
Conditionally execute a ValidationRule
Declaration
Swift
static func `if`( _ condition: Self, then: Self, else: Self ) -> Self
Parameters
condition
The ValidationRule that will be evaluated
then
The then ValidationRule
else
The optional ValidationRule
-
Performs a logical
NOT
(!
) operation on a ValidationRuleDeclaration
Swift
static prefix func ! ( rule: EUDCC.ValidationRule ) -> Self
Parameters
rule
The ValidationRule to negate
-
Performs a logical
AND
(&&
) operation on two ValidationRulesDeclaration
Swift
static func && ( lhs: Self, rhs: Self ) -> Self
Parameters
lhs
The left-hand side of the operation
rhs
The right-hand side of the operation
-
Performs a logical
OR
(||
) operation on two ValidationRulesDeclaration
Swift
static func || ( lhs: Self, rhs: Self ) -> Self
Parameters
lhs
The left-hand side of the operation
rhs
The right-hand side of the operation
-
An EUDCC ValidationRule Tag
See moreDeclaration
Swift
struct Tag : Codable, Hashable
extension EUDCC.ValidationRule.Tag: CustomStringConvertible
extension EUDCC.ValidationRule.Tag: ExpressibleByStringInterpolation
-
The default
EUDCC.ValidationRule
Declaration
Swift
static var `default`: `Self` { get }
-
Returns a Boolean value indicating whether two values are equal.
Declaration
Swift
public static func == ( lhs: Self, rhs: Self ) -> Bool
Parameters
lhs
A value to compare.
rhs
Another value to compare.
-
Hashes the essential components of this value by feeding them into the given hasher.
Declaration
Swift
public func hash( into hasher: inout Hasher )
Parameters
hasher
The hasher to use when combining the components of this instance.