Swiftpack.co -  kieranb662/CGExtender as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Frequently reused helpers and functions for coregraphics types
.package(url: "https://github.com/kieranb662/CGExtender.git", from: "1.0.4")


Useful extensions and functions used with coregraphics types like CGFloat, CGPoint, and CGSize

Collision Functions

Checkout the collisions example project for how to make use of the functions in SwiftUI

  • Point/Line
  • Point/Circle
  • Point/Rectangle
  • Point/Polygon
  • Line/Line
  • Line/Rectangle
  • Line/Circle
  • Line/Polygon
  • Circle/Circle
  • Circle/Rectangle
  • Circle/Polygon
  • Rectangle/Rectangle
  • Rectangle/Polygon
  • Polygon/Polygon


  • VectorArithmetic Conformance
  • Random Value in range


  • VectorArithmetic Conformance
  • Random Value in range

Clamping Functions

Clamps within range of two given values

Geometry Functions

  • atanP - function returns only positive values between [0, 2π]
  • calculateDirection -Calculates the direction between two points relative to the vector pointing in the trailing direction
  • project - Projects the point p onto the line segment defined by the points L1 and L2
  • calculateParameter - Projects the point p onto the vector defined by the points L1 and L2, uses the parametric form of the line segment from L1 to L2 to constrain the projected point to be on the line segment
  • distance - gets the distance between two points


Stars: 6
Last commit: 25 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

Added platform for archive builds
27 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API