Releases: RougeWare/Swift-Rectangle-Tools
2.13 beta • Added negation
- #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`
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
toCollection2D
- #66 Changed
2.12.1
- #67 Added
distance
- #67 Added
2.12.2
- #68 Made (min/max)X(min/max)Y more useful
Full Changelog: 2.11.0...2.12.2
2.11 - Scaling
Rectangle
s and TwoDimensional
s 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
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
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
union(with:)
- to create a new rectangle which is a union of two rectanglesformUnion(with:)
- mutates a rectangle to also encompass anothergrandUnion()
- returns the smallest rectangle which encompasses all rectangles in a collection
2.7.0 - Added `Rectangle.init(minX:minY:maxX:maxY:)`
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`
This genericizes and extends types like NSEdgeInsets
/UIEdgeInsets
/EdgeInsets
2.5.0 - iOS Support
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`
TwoDimensional
now has these:
aspectRatio()
- Returns the ratio of the X measurement to the Y measurementgreaterThanZero
- Returns a copy whereminMeasurement
- Simply returns the lower of the two measurementsmaxMeasurement
- Simply returns the greater of the two measurementsproduct
- Returns the result of multiplying the measurements together
And Size2D
has these:
minSideLength
- LikeminMeasurement
, but never negativemaxSideLength
- LikemaxMeasurement
, but never negativearea
- Likeproduct
, 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.