Gradient app (mostly) converted to Swift