Pretty misleading title. This isn't a bit of graphical code golf using Swift. It's a single call to a gradient API, and even that is independent of Swift.
Well yeah, it’s a few Core Graphics calls, just like it has been from Objective C since OS X was born. This is something CG has built-in, not a feature of Swift.