Gas
public struct Gas
An object that represents a scuba diving breathing gas.
Since
1.0-
Percentage of oxygen in gas blend.
Declaration
Swift
private(set) public var percentOxygen: Double { get } -
Percentage of nitrogen in gas blend.
Declaration
Swift
private(set) public var percentNitrogen: Double { get } -
Percentage of helium in gas blend, not currently available though any initializers.
Declaration
Swift
private(set) public var percentHelium: Double { get } -
Percentage of contaminant gases in gas blend
Declaration
Swift
private(set) public var percentContaminantGases: Double { get } -
Percentage of trace gases in gas blend
Declaration
Swift
private(set) public var percentTraceGases: Double { get }
-
Current absolute pressure on gas.
Declaration
Swift
public var pressure: Double -
Current fractional volume of gas.
Declaration
Swift
public var fractionVolume: Double -
Current density of gas.
Declaration
Swift
public var density: Double
-
A
PartialPressureobject that holds the current partial pressures of the gases constituent gas.Declaration
Swift
public var partialPressure: PartialPressure { get }
-
Property that holds a String representing a contaminant and Double representing percentage of the contaminant
Declaration
Swift
private(set) public var contaminants: [String : Double] { get } -
A Boolean value indicating whether the gas has any gaseous contaminants.
Declaration
Swift
public var isContaminated: Bool { get }
-
Sets contaminant and its percentage.
Since
1.0
Declaration
Swift
public mutating func setContaminants(_ contaminants: [String : Double]) throwsParameters
contaminants[String: Double] where String represents a contaminant and Double represents percentage of the contaminant.
-
A Boolean value indicating whether the gas contains a percentage of oxygen high that 20.9%.
Declaration
Swift
public var isEnrichedAir: Bool { get }
-
Calculates what the effective percentage of a component gas when breathed at a pressure greater than surface pressure.
Example
do { var gas = try Gas.init(percentOxygen: 20.8, percentNitrogen: 79, percentTraceGases: 0.1, percentContaminantGases: 0.1) try gas.setDepth(99, diveKit: DiveKit.default) let effectivePercent = gas.effectivePercentage(gas.percentContaminantGases) print(effectivePercent) // 0.4 (%) } catch { // Handle Error print(error.localizedDescription) }Since
1.0Declaration
Swift
public func effectivePercentage(_ value: Double) -> DoubleParameters
valueDouble representing the component gas to perform calculation on.
Return Value
Double representing the effective percentage of a component gas when breathed at a pressure greater than surface pressure.
-
A singleton gas object representing compressed air.
Since
1.0Declaration
Swift
public static var air: Gas { get } -
A singleton gas object representing enriched air blend of a specified percentage of oxygen.
Since
1.0
Declaration
Swift
public static func enrichedAir(_ percentOxygen: Double) throws -> GasParameters
percentOxygenDouble representing the percentage of oxygen in gad blend, value must be a positive number less than 100.
-
Initializes a
Gasobject.Since
1.0
Declaration
Swift
public init( percentOxygen: Double, percentNitrogen: Double, percentTraceGases: Double = 0, percentContaminantGases: Double = 0) throwsParameters
percentOxygenDouble representing the percentage of oxygen in the gas blend, the value must be a positive number less than 100.
percentNitrogenDouble representing the percentage of nitrogen in the gas blend, the value must be a positive number less than 100.
percentContaminantGasesDouble representing the percentage of contaminant gases in the gas blend, the value must be a positive number less than 100.
percentTraceGasesDouble representing the percentage of trace gases in the gas blend, the value must be a positive number less than 100.
Gas Structure Reference