Skip to content

Releases: RougeWare/Swift-Rectangle-Tools

2.13 beta • Added negation

08 Aug 21:38
c172648
Compare
Choose a tag to compare
Pre-release
  • #69: negation • Adding a - sign before any 2D value negates/inverts its two values, for 2D values whose components support inversion

Full Changelog: 2.12.2...2.13.0-beta.1

2.12 –  Changed `Size2DCollection` to `Collection2D`

16 Nov 22:07
1dbfafd
Compare
Choose a tag to compare

And We did it without breaking existing code! Woo!

This change makes that protocol more generic, so it can be applied to sizes, rectangles, anything which conforms. By default now, all integer sizes and rectangles gain this behavior which was once available only to sizes.

Part of this was removing the requirement for conforming types to also conform to Size2D, and creating a new conformance requirement: CartesianMeasurable. We then changed Size2D to require CartesianMeasurable, and that enabled this broadening.

What's Changed

  • 2.12.0
    • #66 Changed Size2DCollection to Collection2D
  • 2.12.1
    • #67 Added distance
  • 2.12.2
    • #68 Made (min/max)X(min/max)Y more useful

Full Changelog: 2.11.0...2.12.2

2.11 - Scaling

14 Jan 20:19
f168105
Compare
Choose a tag to compare

Rectangles and TwoDimensionals can now be scaled within another one!

This is handy for when you need, for instance, a photo to be scaled down to fit in a chat message, or a wallpaper to be scaled up to fill a background.

The following scaling methods and directions are supported, and tested with 648 test assertions to guarantee expected behavior:

Methods

  • Fit - Ensure the whole object is visible without clipping within its parent
  • Fill - Ensure the whole parent is filled with this object, exceeding boundaries as necessary, but not scaling larger than needed
  • Match height - The object is scaled to match the height of its parent, exceeding horizontal boundaries as necessary
  • Match width - The object is scaled to match the width of its parent, exceeding vertical boundaries as necessary
  • Stretch - The object is made the same as its parent

Directions

  • Down - The object will either remain the same size or reduce in size
  • Up or down - The object will increase or reduce in size as necessary

2.10 - Treating SwiftUI as a native framework

22 Jul 20:54
d91b866
Compare
Choose a tag to compare

It's clear that Apple is moving forward with SwiftUI as the future of all their platforms, so now this package treats it like that too.

This update makes SwiftUI.EdgeInsets one of the NativeEdgeInsets.

Patches

  • 2.10.1 - Addressed an oversight which prevented this from compiling for WatchOS (#63)

2.9 - `.zero` and `.one` for Dual-2D

15 Aug 07:14
2.9.2
e577664
Compare
Choose a tag to compare

This mainly adds .zero and .one to DualTwoDimensional, so any rectangle can be easily created so that all 4 of its constituent dimensions are 0 or 1.

I also bundled into this release a first-attempt at fixing #48. Not confident, since it feels like a real Apple-side bug, but I think this might at least improve some flows.

2.8.0 - Union functions

06 Aug 04:45
428ced0
Compare
Choose a tag to compare
  • union(with:) - to create a new rectangle which is a union of two rectangles
  • formUnion(with:) - mutates a rectangle to also encompass another
  • grandUnion() - returns the smallest rectangle which encompasses all rectangles in a collection

2.7.0 - Added `Rectangle.init(minX:minY:maxX:maxY:)`

06 Aug 03:16
d601b68
Compare
Choose a tag to compare

This allows you to initialize a rectangle by saying where its edges are, like this:

.init(
    minX: 0,
    minY: 2,
    maxX: 4,
    maxY: 6
)
6 ┢━━━━━━━┓
5 ┃       ┃
4 ┃       ┃
3 ┃       ┃
2 ┡━━━━━━━┛
1 │
0 ┼────────────
  0 1 2 3 4 5 6


  0 1 2 3 4 5 6
0 ┼────────────
1 │
2 ┢━━━━━━━┓
3 ┃       ┃
4 ┃       ┃
5 ┃       ┃
6 ┡━━━━━━━┛

2.6.0 - Added `FourSidedAbsolute`

25 Mar 18:29
0bc598f
Compare
Choose a tag to compare

This genericizes and extends types like NSEdgeInsets/UIEdgeInsets/EdgeInsets

2.5.0 - iOS Support

18 Feb 00:50
bd3fbcf
Compare
Choose a tag to compare

Added iOS support by conditionally compiling Float80 only for non-Windows x86 systems, importing CoreGraphics, and updating MultiplicativeArithmetic to 1.3.0. Yay easy support changes!

2.4.0 - Added a few conveniences to `TwoDimensional` and `Size2D`

04 Jan 03:27
54e1e05
Compare
Choose a tag to compare

TwoDimensional now has these:

  • aspectRatio() - Returns the ratio of the X measurement to the Y measurement
  • greaterThanZero - Returns a copy where
  • minMeasurement - Simply returns the lower of the two measurements
  • maxMeasurement - Simply returns the greater of the two measurements
  • product - Returns the result of multiplying the measurements together

And Size2D has these:

  • minSideLength - Like minMeasurement, but never negative
  • maxSideLength - Like maxMeasurement, but never negative
  • area - Like product, but never negative

Some of these are duplicated for different types of Length since each has its own requirements. The goal is to provide consistent functionality regardless.