Swift2D

2.1

Swift library for working in two-dimensional coordinate systems.
richardpiazza/Swift2D

What's New

Swift2D 2.1

2023-03-20T14:14:48Z

New Features:

  • Added a reflection calculation on Point.

Other Updates:

  • Cleanup of entity initializers
  • Removed un-needed explicit returns
  • Removed un-needed Linux specific testing infrastructure.

Swift2D

Swift library for working in two-dimensional coordinate systems.

Twitter: @richardpiazza

Features

This library provides structs for Point, Size, and Rect based on the swift standard library. No Foundation or CoreGraphics imports are required.

Point

struct Point {
  var x: Double
  var y: Double
}

Size

struct Size {
  var width: Double
  var height: Double
}

Rect

struct Rect {
  var origin: Point
  var size: Size
}

Usage

Swift2D is distributed using the Swift Package Manager. To install it into a project, add it as a dependency within your Package.swift manifest:

let package = Package(
    ...
    dependencies: [
        .package(url: "https://github.com/richardpiazza/Swift2D.git", from: "1.1.0")
    ],
    ...
)

Then import the Swift2D packages wherever you'd like to use it:

import Swift2D

Description

  • Swift Tools 5.2.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sat Mar 16 2024 09:32:32 GMT-0900 (Hawaii-Aleutian Daylight Time)