Skip to content

Releases: layoutBox/PinLayout

Add `wrapContent()` methods

06 Jun 01:33
Compare
Choose a tag to compare

Add wrapContent() methods that adjust view's width & height to wrap all its subviews.

The following methods are useful to adjust view's width and/or height to wrap all its subviews. These methods also adjust subviews position to create a tight wrap.

Methods:

  • wrapContent()
    wrapContent(padding: CGFloat)
    wrapContent(padding: UIEdgeInsets)
    Adjust the view's width and height to wrap all its subviews. The method also adjusts subviews position to create a tight wrap. It is also possible to specify an optional padding around all subviews.
  • wrapContent(:WrapType)
    wrapContent(:WrapType, padding: CGFloat)
    wrapContent(:WrapType, padding: UIEdgeInsets)
    Adjust the view's width AND/OR height to wrap all its subviews. WrapType values are .horizontally/.vertically/.all It is also possible to specify an optional padding around all subviews.

See documentation for more information

Added by Luc Dion in Pull Request #141

Objective-C support for macOS and tvOS

26 May 12:58
Compare
Choose a tag to compare

Add the support of Objective-C to macOS and tvOS.

Add few missing Objective-C Interface properties and methods

25 Apr 20:46
Compare
Choose a tag to compare

These methods and properties are now accessible from Objective-C:

  • Pin.layoutDirection
  • Pin.safeAreaInsetsDidChangeMode
  • Pin.logWarnings
  • Pin.initPinLayout()
  • Pin.layoutDirection()

Added by Luc Dion in Pull Request #135

Fine tune UIView.pin.safeArea support for iOS 8 and "New Relic" framework

23 Apr 13:31
Compare
Choose a tag to compare
  • On iOS 8, PinLayout compatibility support of UIView.safeAreaInsetsDidChange was causing issues with the device's virtual keyboard. PinLayout still support UIView.pin.safeArea on this iOS release, but UIView.safeAreaInsetsDidChange won't be called on iOS 8

  • Fix issue with "New Relic" framework: Add a Pin.initPinLayout() that can be called to initialize PinLayout before the "New Relic" framework is initialized. "New Relic" is conflicting with other popular frameworks including Mixpanel, ReactiveCocoa, Aspect, ..., and PinLayout. To fix the issue, Pin.initPinLayout() must be called BEFORE initializing "New Relic" with NewRelic.start(withApplicationToken:"APP_TOKEN"). See here for more information regarding this issue #130

Added by Luc Dion in Pull Request #134

Add macOS support

20 Apr 12:16
Compare
Choose a tag to compare

PinLayout now support macOS.

PinLayout support of macOS is not complete at 100%, see here the particularities of the current implementation:

  • PinLayout support only views that have a parent (superview) using a flipped coordinate system, i.e. views for which the computed property var isFlipped: Bool returns true. In a flipped coordinate system, the origin is in the upper-left corner of the view and y-values extend downward. UIKit use this coordinate system. In a non-flipped coordinate system (default mode), the origin is in the lower-left corner of the view and positive y-values extend upward. See Apple's documentation for more information about NSView.isFlipped. The support of non-flipped coordinate system will be added soon.

  • These methods are currently not supported on macOS, but they will be implemented soon:

    • sizeToFit(:FitType) (Coming soon)
    • aspectRatio() with no parameters (Coming soon)
  • UIView.pin.safeArea property is not available, AppKit doesn't have an UIView.safeAreaInsets equivalent.

All other PinLayout's methods and properties are available on macOS!

Added by Luc Dion in Pull Request #131

PinLayout now use MIT license

The PinLayout license has been changed from BSD 3-clause "New" to MIT License.

UIView.pin.safeArea / safeAreaInsetsDidChange() / margins percentage methods

22 Mar 12:41
Compare
Choose a tag to compare

Released on 2018-03-22

UIView.pin.safeArea

PinLayout can handle easily iOS 11 UIView.safeAreaInsets, but it goes further by supporting safeAreaInsets for previous iOS releases (including iOS 7/8/9/10) by adding a property UIView.pin.safeArea. PinLayout also extend the support of UIView.safeAreaInsetsDidChange() callback on iOS 7/8/9/10.

See UIView.pin.safeArea Documentation for more details.

Added by Luc Dion in Pull Request #125

Add methods taking UIEdgeInset as parameter

  • all(_ insets: UIEdgeInsets)

  • horizontally(_ insets: UIEdgeInsets)

  • vertically(_ insets: UIEdgeInsets)

  • top(_ insets: UIEdgeInsets)

  • bottom(_ insets: UIEdgeInsets)

  • left(_ insets: UIEdgeInsets)

  • right(_ insets: UIEdgeInsets)

    See Layout using distances from superview’s edges for more details.

    Added by Luc Dion in Pull Request #125

Add margins method with percentage parameter

  • marginTop(_ percent: Percent)

  • marginLeft(_ percent: Percent)

  • marginBottom(_ percent: Percent)

  • marginLeft(_ percent: Percent)

  • marginStart(_ percent: Percent)

  • marginEnd(_ percent: Percent)

  • marginHorizontal(_ percent: Percent)

  • marginVertical(_ percent: Percent)

  • margin(_ percent: Percent)

  • margin(_ vertical: Percent, _ horizontal: Percent)

  • margin(_ top: Percent, _ horizontal: Percent, _ bottom: Percent)

  • margin(_ top: Percent, _ left: Percent, _ bottom: Percent, _ right: Percent)

    Added by vandyshev in Pull Request #126

Add `pinFrame` property to control differently how view's transform are handled

18 Feb 13:19
Compare
Choose a tag to compare

UIView.pin versus UIView.pinFrame

Until now UIView.pin was used to layout views, but there's also another property called UIView.pinFrame that does something slightly different in situations where the view has a transform (UIView.transform, scaling, rotation, ...).

  • pin: Set the position and the size of the non-transformed view. The size and position is applied before the transform. This is particularly useful when you want to animate a view using a transform without modifying its layout.

  • .pinFrame: Set the position and the size on the transformed view. The size and position is applied after the transform.

See https://github.com/mirego/PinLayout#uiviews-transforms for more informations.

Added by Luc Dion in Pull Request #122

Handle layout relative to a view with a transform and/or a modified anchorPoint

20 Jan 18:56
Compare
Choose a tag to compare

Improve PinLayout view's coordinates adjustment

19 Jan 12:49
Compare
Choose a tag to compare
  • Fix an issue that was affecting UIScrollViews. PinLayout now set only the bounds' size and keep the origin.
    Added by Luc Dion in Pull Request #115

  • Handle correctly view's layer.anchorPoint. PinLayout now updates correctly the view position when the view's layer.anchorPoint has been modified, i.e. when it is not its default value (0.5, 0.5).
    Added by Luc Dion in Pull Request #114

Fix a compilation warning

14 Jan 16:19
Compare
Choose a tag to compare
1.5.6

Fix a compilation warning.