Skip to content
Permalink
Browse files

Update README.md

  • Loading branch information
Sam-Spencer committed Aug 26, 2019
1 parent 01cb961 commit 1ce64294f2212579be40d18776f809a748b9002f
Showing with 15 additions and 2 deletions.
  1. +15 −2 README.md
@@ -10,10 +10,23 @@ Making `CGRect` play nice with data storage and calculations is annoying. That's

Directly access `NSNumber` values for `CGRect` properties without needing to write repetitive boilerplate code that converts `origin` and `size` values.

// Code example coming soon
let bounds = CGRect.init(x: 10, y: 10, width: 100, height: 300)

// CGRect extension lets you retrieve an NSNumber for any x, y, width, or height value
let heightForCoreData: NSNumber = bounds.number(from: .height)

// CGSize extension lets you directly retrieve the number value as a calculated property
let heightFromCGSizeForCoreData: NSNumber = bounds.size.heightNumber


Directly access `Float` values for `CGRect` to quickly perform type-safe, value-guaranteed calculation. Again, without needing to write repetitive boilerplate code that converts `origin` and `size` values.

// Code example coming soon

let frame = CGRect.init(x: 10, y: 10, width: 100, height: 300)

// CGRect extension lets you retrieve an Float for any x, y, width, or height value
let xForCalculation: Float = bounds.float(from: .x)

// CGPoint extension lets you directly retrieve the float value as a calculated property
let xFromCGPointForCoreData: Float = bounds.origin.x

0 comments on commit 1ce6429

Please sign in to comment.
You can’t perform that action at this time.