MyLocations - Color Format


Sorry if this has been asked before, I’m a total newbie. I’m going through the MyLocations iOS Apprentice Book when I noticed on page 264, that there are times when setting colors we are using ‘’ and sometimes we are just using ‘.black’. Are these interchangeable?

In this context, I think they’re interchangeable. The fields you’re setting (e.g. tableView.backgroundColor) are known to be of type UIColor, so Swift can infer that .black is short for

In other contexts, Swift might not able to infer a type so easily, so you’ll need to be explicit and type UIColor in.

Ok, thanks for the explanation. Appreciate the help.