Calculate absolute humidity and dew point from relative humidity and temperature
- Absulute Humidity (g/m³)
- Dew Point (°C, °F)
- iOS 10.0+
- Xcode 10.2.1+
You can use CocoaPods to install Humidity
by adding it to your Podfile
:
platform :ios, '10.0'
use_frameworks!
pod 'Humidity'
To get the full benefits import Humidity
import Humidity
import Humidity
var absoluteHumidity = Humidity(value: 10.812216095573042, unit: .absolute)
// Converting
absoluteHumidity.converted(to: .relative(temperature: 24.9).value // 0.472
// DewPoint
do {
let dewPoint = try absoluteHumidity.dewPoint(temperature: Constants.temp)
print(dewPoint.converted(to: .fahrenheit).value) // 55.20564209577756
} catch {
print(error.localizedDescription)
}
// HumidityFormatter
let formatter = HumidityFormatter()
formatter.unitStyle = .short
// Also you can change number formats using NumberFormatter
formatter.numberFormatter = NumberFormatter()
formatter.numberFormatter.maximumFractionDigits = 2
print(formatter.string(from: absoluteHumidity))
You can change locale for HumidityFormatter in HumiditySettings
HumiditySettings.setLanguage(.en)
Two languages are available:
- english
- russian
We would love you for the contribution to Humidity, check the LICENSE
file for more info.
The IAPWS Formulation 1995 for the Thermodynamic Properties of Ordinary Water Substance for General and Scientific Use Foundation Units and Measurement at developer.apple.com
Rinat Enikeev – [email protected]
Distributed under the BSD license. See LICENSE
for more information.