NSEntityDescription name Optional

25 Views Asked by At

I have an instance of NSEntityDescription that I obtained through the entity() method on the class of an NSManagedObject subclass. I want to get its name, but the type of that property is String? rather than just String

let entityName: String = MyManagedObjectSubclass.entity().name // Error: Must be unwrapped

Under what circumstances would the name be nil? Is it safe to force-unwrap in this context? I have yet to see it return nil, but I'd like to make sure I'm appropriately handling whatever case would cause that to happen

0

There are 0 best solutions below