The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
2.12 βΒ Changed `Size2DCollection` to `Collection2D`
23 weeks ago
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**: https://github.com/RougeWare/Swift-Rectangle-Tools/compare/2.11.0...2.12.2
2.11 - Scaling
2 years ago
`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
2 years ago
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
3 years ago
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
3 years ago
- `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:)`
3 years ago
This allows you to initialize a rectangle by saying where its edges are, like this:
```swift
.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`
4 years ago
This genericizes and extends types like `NSEdgeInsets`/`UIEdgeInsets`/`EdgeInsets`
2.5.0 - iOS Support
4 years ago
Added iOS support by conditionally compiling `Float80` only for non-Windows x86 systems, importing `CoreGraphics`, and updating [`MultiplicativeArithmetic`](https://github.com/RougeWare/Swift-MultiplicativeArithmetic/releases/tag/1.3.0) to 1.3.0. Yay easy support changes!
2.4.0 - Added a few conveniences to `TwoDimensional` and `Size2D`
4 years ago
`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.
2.3.1 - Added `min`/`mid`/`max` `x`/`y` lines/points to all sizes and rects
4 years ago
### Now, all sizes and rectangles have the following computed properties on them! ###
- `minX`
- `midX`
- `maxX`
- `minY`
- `midY`
- `maxY`
- `minXminY`
- `minXmidY`
- `minXmaxY`
- `midXminY`
- `midXmidY` / `center`
- `midXmaxY`
- `maxXminY`
- `maxXmaxY`
- `maxXmidY`
### And these rectangle-only functions: ###
- `percent(alongX:)`
- `percent(alongY:)`
- `relativePoint(xPercent:yPercent:)`
- `minX(yPercent:)`
- `maxX(yPercent:)`
- `minY(xPercent:)`
- `maxY(xPercent:)`
These are split into two separate sets of APIs, which I hope will work harmoniously:
1. Fetching a point within an **integer** rectangle by passing **some other floating-point type** percentages, which returns the rectangle's **integer** type
2. Fetching a point within a **floating-point** rectangle by passing **the rectangle's floating-point type** percentages, which returns the rectangle's **floating-point** type
### And this incidental new protocol: ###
- `InitializableFromInteger`
- `init(_:)` which takes any `BinaryInteger`
This might someday find its way to a new package.
### Relevant tickets ###
- #24
- #34
- #38