In my app I have an image resizing method that I use to create a thumbnail of an image; here is the code.
private func resize(withSize size: CGSize) ->