Skip to content

Instantly share code, notes, and snippets.

@artemkrachulov
Last active July 25, 2016 07:42
Show Gist options
  • Save artemkrachulov/ec923f20b8f2c3f42dd592fae4c3f8f3 to your computer and use it in GitHub Desktop.
Save artemkrachulov/ec923f20b8f2c3f42dd592fae4c3f8f3 to your computer and use it in GitHub Desktop.
//
// CGSize+Geometry.swiftt
//
// Created by Artem Krachulov.
// Copyright (c) 2016 Artem Krachulov. All rights reserved.
// http://www.artemkrachulov.com
//
import UIKit
// MARK: - Geometry
extension CGSize {
/// Return size where width and height property increased by multiplier times.
///
/// Usage:
///
/// var size = CGSizeMake(500, 200)
/// size.increaseBy(multiplier: 10) // {w 5,000 h 2,000}
///
public func increaseBy(multiplier multiplier: CGFloat) -> CGSize {
return CGSizeMake(width * multiplier, height * multiplier)
}
public func increase(byDx dx: CGFloat, dy: CGFloat) -> CGSize {
return CGSizeMake(width + dx, height + dy)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment