Read and compare the value of CKRecord?

117 views Asked by At

Is there have any solution to read and compare the value of CKRecord? In a word, something like:

if valueOfRecord("Country") == "Taiwan" {
// code
}
1

There are 1 answers

2
Shahriar Nasim Nafi On

Faster way,


if (object("Country") as! NSString) == "Taiwan" {
// code
}

Safer Way

if let countryName = object("Country") as? NSString {
     if countryName == "Taiwan" {
      // code
     }
} else {
    // object("Country") in not a string type record
}