Skip to content

Releases: layoutBox/PinLayout

Add methods to layout a view between two other views

28 Aug 23:35

Choose a tag to compare

Add methods to layout a view between two other views

Add methods to position a view between two other views, either horizontally or vertically.

New Methods:

  • horizontallyBetween(:UIView, and: UIView)
    Position the view between the two specified views horizontally. The method layout the view's left and right edges. The order of the reference views is irrelevant.
    Note that the layout will be applied only if there is horizontal space between the specified views.

  • horizontallyBetween(:UIView, and: UIView, aligned: VerticalAlign)
    Position the view between the two specified views horizontally and aligned it using the specified VerticalAlign. The view will be aligned related to the first specified reference view. Note that the layout will be applied only if there is horizontal space between the specified views.

  • verticallyBetween(:UIView, and: UIView)
    Position the view between the two specified views vertically. The method layout the view's top and bottom edges. The order of the reference views is irrelevant. Note that the layout will be applied only if there is vertical space between the specified views.

  • verticallyBetween(:UIView, and: UIView, aligned: HorizontalAlign)
    Position the view between the two specified views vertically and aligned it using the specified HorizontalAlign. The view will be aligned related to the first specified reference view. Note that the layout will be applied only if there is vertical space between the specified views.

Example:

   view.pin.verticallyBetween(viewA, and: viewB, aligned: .center).marginVertical(10)

See Readme for more information

Add `pin.readableMargins` and `pin.layoutmargins` properties

25 Aug 18:40

Choose a tag to compare

Add properties:

  • pin.readableMargins: UIEdgeInset:
    PinLayout's UIView.pin.readableMargins property expose UIKit UIView.readableContentGuide as an UIEdgeInsets. This is really useful since UIKit only expose the readableContent area to Auto Layout using UILayoutGuide.

  • pin.layoutmargins: UIEdgeInset
    PinLayout's UIView.pin.layoutMargins property expose directly the value of UIKit UIView.layoutMargins. The property exists only to be consistent with the other areas: pin.safeArea, pin.readableMargins and pin.layoutmargins. So its usage is not necessary.

Add examples using these properties:
pinlayout_example_layout_margins_all

pinlayout_example_tableview_readable_content_all

PinLayout Swift 3 support

23 Aug 12:31

Choose a tag to compare

PinLayout supports Swift 3 and Swift 4

Deprecated method `fitSize()` has been removed

21 Aug 23:52

Choose a tag to compare

BREAKING CHANGE: fitSize() has been removed after being deprecated for 10 months. sizeToFit(:FitType) should now be used instead. See Adjusting size.

Plus:

  • Refactor relative positioning methods source code (above(...), after(...), ...) using a default parameter value for the alignment parameter.

  • Fix unit test screen density.

  • Update few examples source code.

  • Added by Luc Dion in Pull Request #167

Add Animations documentation and examples + 'private' declarations

16 Aug 11:16

Choose a tag to compare

  • Add documentation that explains how PinLayout can handle view's animations.

    • Show few strategies that can be used to animate views.
  • Add animation examples using PinLayout

  • Convert fileprivate to private declarations

  • Add an new "Examples" markdown page showing all PinLayout's examples.

  • Added by Luc Dion in Pull Request #165

Method that position multiple edges now accept an `offset` parameter

06 Aug 11:04

Choose a tag to compare

Method that position multiple edges now accept an offset parameter that specifies the distance from their superview's corresponding edges in pixels.

New methods:

  • topLeft(_ offset: CGFloat)

  • topCenter(_ topOffset: CGFloat)

  • topRight(_ offset: CGFloat)

  • centerLeft(_ leftOffset: CGFloat)

  • center(_ offset: CGFloat)

  • centerRight(_ rightOffset offset: CGFloat)

  • bottomLeft(_ offset: CGFloat)

  • bottomCenter(_ bottomOffset: CGFloat)

  • bottomRight(_ offset: CGFloat)

For example, to position a view at the top left corner with a top and left margin of 10 pixels:

   view.pin.topLeft(10)

Other change

Cleanup the interface by using default value parameters.

Add `sizeToFit()` method

17 Jul 14:33

Choose a tag to compare

Add sizeToFit() method

The method adjust the view's size based on the result of the method UIView.sizeToFit(). Particularly useful for controls/views that have an intrinsic size (label, button, ...).

Fix a regression

28 Jun 13:13

Choose a tag to compare

The recent changes to PinLayout that enable the layout of CALayer has impacted the layout of UIViews.

Add support for CALayer layout

26 Jun 22:02

Choose a tag to compare

PinLayout can now layouts CALayer's. All PinLayout's properties and methods are available, with the following exceptions:

  • sizeToFit(:FitType) is not supported. Support for sizeToFit(:FitType) can be added to your custom CALayer subclasses, just make those layers conform to the SizeCalculable protocol and implement the two required functions.
  • CALayer.pin.safeArea property is not available.
  • aspectRatio() with no parameters

See CALayer Support documentation for more information

Refactoring using generics

20 Jun 01:33

Choose a tag to compare

Refactoring to avoid having to deal directly with view types, making it easier to extend layouting to other APIs (e.g: CALayer)