Swift 5.0 cannot use the #ffffff
syntax directly. Here is the code I use for web-related projects. Supports alpha and three-digits.
Usage example (uppercase values are fine too):
let hex = "#FADE2B" // yellow
let color = UIColor(fromHex: hex)