Other Functions
The following functions are available globally.
-
Returns the unit string for the specified
AWFMeasurement
and Metric designation.Declaration
Objective-C
AWFUnit _Nonnull AWFUnitForMeasurement(AWFMeasurement type, BOOL metric)
Swift
func AWFUnitForMeasurement(_ type: AWFMeasurement, _ metric: Bool) -> AWFUnit
-
Returns the unit of measurement for the specified data type.
Declaration
Objective-C
NSString *_Nullable AWFUnitForWeatherDataType(AWFWeatherDataType type, BOOL metric)
Swift
func AWFUnitForWeatherDataType(_ type: AWFWeatherDataType, _ metric: Bool) -> String?
Parameters
type
The data type to return the unit for
metric
Whether the metric unit should be returned
-
Returns whether or not the specified
unit
corresponds to a Metric value.Declaration
Objective-C
BOOL AWFUnitIsMetric(AWFUnit _Nonnull unit)
Swift
func AWFUnitIsMetric(_ unit: AWFUnit) -> Bool
Parameters
unit
The
AWFUnit
valueReturn Value
YES
if the unit is for Metric values, otherwiseNO
. -
Converts a value from one unit to another. The units must belong to the same measurement type (e.g., temperature, speed, distance, etc).
Declaration
Objective-C
CGFloat AWFConvert(CGFloat value, AWFUnit _Nonnull from, AWFUnit _Nonnull to)
Swift
func AWFConvert(_ value: CGFloat, _ from: AWFUnit, _ to: AWFUnit) -> CGFloat
Parameters
value
The value to convert
from
The current units the value is provided in
to
The units to convert the specified value to
Return Value
The converted value
-
Tests if an object is empty.
Declaration
Objective-C
BOOL AWFIsEmpty(id _Nonnull object)
Swift
func AWFIsEmpty(_ object: Any) -> Bool
-
Returns whether the specified
object
is a valid place string in the format city, state, city, country or city, state, country (e.g. seattle,wa or paris,france).Declaration
Objective-C
BOOL AWFIsValidPlaceString(id _Nonnull object)
Swift
func AWFIsValidPlaceString(_ object: Any) -> Bool
Parameters
object
The object to validate.
Return Value
YES
if the object is a valid place string, otherwiseNO
. -
Returns whether the specified
object
is a valid zip code or postal code string (e.g. 55415 or V5K 1L5).Declaration
Objective-C
BOOL AWFIsValidZipcodeString(id _Nonnull object)
Swift
func AWFIsValidZipcodeString(_ object: Any) -> Bool
Parameters
object
The object to validate.
Return Value
YES
if the object is a valid zip code/postal code string, otherwiseNO
. -
Returns whether the specified
object
is a valid coordinate string in the format latitude, longitude (e.g. 30.26715, -97.74306).Declaration
Objective-C
BOOL AWFIsValidCoordinateString(id _Nonnull object)
Swift
func AWFIsValidCoordinateString(_ object: Any) -> Bool
Parameters
object
The object to validate.
Return Value
YES
if the object is a valid coordinate string, otherwiseNO
. -
Returns whether the specified
coordinate
is empty, meaning both its latitude and longitude values are defined as0.0
.Declaration
Objective-C
BOOL AWFCLLocationCoordinate2DIsEmpty(CLLocationCoordinate2D coordinate)
Swift
func AWFCLLocationCoordinate2DIsEmpty(_ coordinate: CLLocationCoordinate2D) -> Bool
Parameters
coordinate
The coordinate to validate.
Return Value
YES
if the coordinate has its latitude and longitude values defined as0.0
, otherwiseNO
.