简体   繁体   中英

how to check if one property of entity model return nil in swift

I'm new in swift.

I have a object of entity example: var person=Person()

person have name, but docent have a lastName. how to check if person.lastName is nil, I have tried but dosen't work . please help

var lastName:String?;

if (person.lastName == nil)
{
  //Do something.
}
else
{
   //Do something
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM