I am writing below function to return value based on data objet that I passed to this method.
If we get data null I am trying to return "-" otherwise If I get any valid response I am returning value..
private func checkDataForValue(data: Optional<AnyObject>) -> String {
if let value = data {
let value1: AnyObject = //have to check <Null>
if value === value1 {
return "-"
}
return "\(value)"
} else {
return "-"
}
}
My question How to compare null value here ..