Skip to content
Makes math operations in Swift easier by adding automatic casting between Int, Float, CGFloat, and Double. Use with care.
Swift
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
EasyCast.swift
LICENSE
README.md

README.md

EasyCast

Makes math operations in Swift easier by adding automatic casting between Int, Float, CGFloat, and Double

Usage

Instead of:

var sum = CGFloat(myInt) + CGFloat(myFloat)

Just do:

var sum = myInt + myFloat

That's pretty much it

When to use this

  • Swift's type-safety is littering your code base with obvious casts.
  • You are working on something where making some type assumption isn't a problem.
  • You know how it works.

When not to use this

  • You want type-safety above all else.
  • You are working on scientific or academic software.
  • You don't know how it works,
You can’t perform that action at this time.