Skip to content

Releases: layoutBox/PinLayout

Add methods: all(_ value: CGFloat), horizontally(_ value: CGFloat), ...

12 Jan 14:26
Compare
Choose a tag to compare

Add methods:

  • all(_ value: CGFloat)
    The value specifies the top, bottom, left and right edges distance from the superview's corresponding edge in pixels.
    Similar to calling view.top(value).bottom(value).left(value).right(value).

  • horizontally(_ value: CGFloat) / horizontally(_ percent: Percent)
    The value specifies the left and right edges on its superview's corresponding edges in pixels (or in percentage of its superview's width).
    Similar to calling view.left(value).right(value).

  • vertically(_ value: CGFloat) / vertically(_ percent: Percent)
    The value specifies the ** top and bottom edges** on its superview's corresponding edges in pixels (or in percentage of its superview's height).
    Similar to calling view.top(value).bottom(value).

PinLayout now handle correctly parents (superviews) with transforms

28 Dec 02:17
Compare
Choose a tag to compare

PinLayout now keeps UIView's transform (scale, rotation, ...)

22 Dec 13:20
Compare
Choose a tag to compare

POSSIBLE BREAKING CHANGE: PinLayout now keeps UIView's transform (scale, rotation, ...)
Previously any view's transform was altered after layouting the view with PinLayout. Now PinLayout won't affect the view's transforms.

For people not using transforms, this should be a non-breaking change. If someone is using transforms with PinLayout, this may change the behavior, although I think this will produce the expected results (ie, transforms not being affected/altered by layout).

* Added by [Luc Dion](https://github.com/lucdion) in Pull Request [#49](https://github.com/mirego/PinLayout/pull/107) 

Add layout() method to support Xcode playgrounds

22 Nov 00:43
Compare
Choose a tag to compare
  • Add layout() method to support Xcode playgrounds

PinLayout layouts views immediately after the line containing .pin has been fully executed, thanks to ARC (Automatic Reference Counting) this works perfectly on iOS/tvOS/macOS simulators and devices. But in Xcode Playgrounds, ARC doesn't work as expected, object references are kept much longer. This is a well-documented issue. The impact of this problem is that PinLayout doesn't layout views at the time and in the order required. To handle this situation in playgrounds it is possible to call the layout() method to complete the layout.

See PinLayout in Xcode Playgrounds documentation for more information

New method `sizeToFit(:FitType)` & `fitSize()` is now deprecated

20 Nov 13:12
Compare
Choose a tag to compare
  • BREAKING CHANGE: fitSize() is now deprecated. The new sizeToFit(:FitType) should be used instead.

  • New method sizeToFit(_ fitType: FitType)

    • sizeToFit(_ fitType: FitType)
      The method adjust the view's size based on the view's sizeThatFits() method result.
      PinLayout will adjust either the view's width or height based on the fitType parameter value.

      Notes:

      • If margin rules apply, margins will be applied when determining the reference dimension (width/height).
      • The resulting size will always respect minWidth / maxWidth / minHeight / maxHeight.

      Parameter fitType: Identify the reference dimension (width / height) that will be used to adjust the view's size.

    • .width: The method adjust the view's size based on the reference width.
      * If properties related to the width have been pinned (e.g: width, left & right, margins, ...), the reference width will be determined by these properties, if not the current view's width will be used.
      * The resulting width will always match the reference width.

    • .height: The method adjust the view's size based on the reference height.
      * If properties related to the height have been pinned (e.g: height, top & bottom, margins, ...), the reference height will be determined by these properties, if not the current view's height will be used.
      * The resulting height will always match the reference height.

    • .widthFlexible: Similar to .width, except that PinLayout won't constrain the resulting width to match the reference width. The resulting width may be smaller of bigger depending on the view's sizeThatFits(..) method result. For example a single line UILabel may returns a smaller width if its string is smaller than the reference width.

    • .heightFlexible: Similar to .height, except that PinLayout won't constrain the resulting height to match the reference height. The resulting height may be smaller of bigger depending on the view's sizeThatFits(..) method result.

Fix Carthage support

31 Oct 13:59
Compare
Choose a tag to compare

Fix an issue that occurs with the latest Carthage version.

Add methods that can pin multiples edges

30 Oct 18:44
Compare
Choose a tag to compare

Add methods that can pin multiples edges:

  • all(): Pin all edges on its superview's corresponding edges (top, bottom, left, right). Similar to calling view.top().bottom().left().right()

  • horizontally(): Pin the left and right edges on its superview's corresponding edges. Similar to calling view.left().right().

  • vertically(): Pin the top and bottom edges on its superview's corresponding edges. Similar to calling view.top().bottom().

Added by Luc Dion in Pull Request #93

View build details and download artifacts on buddybuild:
PinLayout (iOS, PinLayout)

All examples now support iOS 11 and iPhoneX landscape mode + new margin method

24 Oct 12:43
Compare
Choose a tag to compare
  • Add new method margin(_ directionalInsets: NSDirectionalEdgeInsets)

    Set margins using NSDirectionalEdgeInsets.
    This method is particularly to set all margins using iOS 11 UIView.directionalLayoutMargins.

    Available only on iOS 11 and higher.

  • Update all examples so they support iOS 11 and iPhoneX landscape mode. They use the new UIView.safeAreaInsets property.

View build details and download artifacts on buddybuild:
PinLayout (iOS, PinLayout)

PinLayout now apply correctly margins when hCenter or vCenter have been set

18 Oct 11:31
Compare
Choose a tag to compare

PinLayout now apply correctly margins when hCenter or vCenter have been set

  • hCenter: When the Horizontal Center is set, PinLayout now applies the left margin.
  • vCenter: When the Vertical Center is set, PinLayout now applies the top margin.

BREAKING CHANGE: This may be a breaking change if you are using hCenter(..), vCenter(...), center(...), centerRight(...), centerLeft(...), or any other method using the center position while also using a margin.

Add a PinLayout interface compatible with Objective-c

12 Oct 13:01
Compare
Choose a tag to compare

Add a PinLayout interface compatible with Objective-c
The interface is slightly different from the Swift interface.

Major differences:

  • The PinLayout's objective-c interface is available using the property pinObjc (instead of pin in Swift)
  • When using the Objective-c interface, the layout method must be called explicitly to complete the view's layout.

Plus:

  • Add an Objective-c implementation of the PinLayout's Intro example.

View build details and download artifacts on buddybuild:
PinLayout (iOS, PinLayout)