artemkrachulov
7/25/2016 - 7:29 AM

CGSize+Geometry.swift

//
//  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)
  }
}