Skip to content

Instantly share code, notes, and snippets.

@eMdOS
Created July 30, 2018 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eMdOS/545502d96539edae319dc3be5b2260a5 to your computer and use it in GitHub Desktop.
Save eMdOS/545502d96539edae319dc3be5b2260a5 to your computer and use it in GitHub Desktop.
CGSize Scaling
extension CGSize {
func widthScaling(with value: CGFloat) -> CGSize {
return CGSize(width: value, height: (value * height) / width)
}
func heightScaling(with value: CGFloat) -> CGSize {
return CGSize(width: (value * width) / height, height: value)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment