Skip to content

Commit

Permalink
added CGPoint & CGSize operators
Browse files Browse the repository at this point in the history
  • Loading branch information
cemolcay committed Dec 22, 2014
1 parent fe108dc commit cd2b122
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
Binary file not shown.
33 changes: 32 additions & 1 deletion CEMKit-Swift/CEMKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import Foundation
import UIKit


// MARK: UIView

let UIViewAnimationDuration: NSTimeInterval = 1
let UIViewAnimationSpringDamping: CGFloat = 0.5
let UIViewAnimationSpringVelocity: CGFloat = 0.5
Expand Down Expand Up @@ -309,6 +312,17 @@ extension UIView {



// MARK: CGPoint

func + (left: CGPoint, right: CGPoint) -> CGPoint {
return CGPoint (x: left.x + right.x, y: left.y + right.y)
}

func - (left: CGPoint, right: CGPoint) -> CGPoint {
return CGPoint (x: left.x - right.x, y: left.y - right.y)
}


enum AnchorPosition: CGPoint {
case TopLeft = "{0 ,0}"
case TopCenter = "{0.5, 0}"
Expand Down Expand Up @@ -340,6 +354,20 @@ extension CGPoint: StringLiteralConvertible {



// MARK: CGSize

func + (left: CGSize, right: CGSize) -> CGSize {
return CGSize (width: left.width + right.width, height: left.height + right.height)
}

func - (left: CGSize, right: CGSize) -> CGSize {
return CGSize (width: left.width - right.width, height: left.width - right.width)
}



// MARK: UIFont

extension UIFont {

enum FontType: String {
Expand Down Expand Up @@ -393,6 +421,9 @@ extension UIFont {
}



// MARK: CEMKit

var ScreenWidth : CGFloat {
get {
return UIScreen.mainScreen().bounds.size.width
Expand Down Expand Up @@ -484,7 +515,7 @@ func barButtonItem (title: String, color: UIColor, action: (AnyObject)->()) -> U



// MARK: - Button
// MARK: - UIButton

class BlockButton: UIButton {

Expand Down

0 comments on commit cd2b122

Please sign in to comment.