RectangleTools

2.11.0

A set of Swift utilities for dealing with rectangles, including a way to generically build your own!
RougeWare/Swift-Rectangle-Tools

What's New

2.11 - Scaling

2022-01-14T20:19:24Z

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

Swift Rectangle Tools

A set of Swift utilities for dealing with rectangles, including a way to generically build your own!

This package includes new types such as IntRect and UIntPoint, conveniences for doing math with various points in rectangles, centering and scaling, generic protocols to unify math across all rectangular types, conveniences for measuring and placing rectangles, and much more.

Who knew there was so much to be done with rectangles?

Thoroughly Tested

Over 2,000 test assertions prove that this library works as it says it does

Battle Hardened

This library was created for enterprise-scale applications, and is being used by multiple corporations in production today.

SwiftUI

If you're using this with SwiftUI, you can also import RectangleTools_SwiftUI to gain SwiftUI-specific rectangle tools!

Description

  • Swift Tools 5.1.0
View More Packages from this Author

Dependencies

Last updated: Fri Jan 14 2022 16:24:01 GMT-0500 (GMT-05:00)