Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ios.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarinofaggiana <marino@marinofaggiana.com>2020-05-18 10:57:55 +0300
committermarinofaggiana <marino@marinofaggiana.com>2020-05-18 10:57:55 +0300
commit89c69e4e34723e700839b22b19753afb8910af4d (patch)
tree4fbce50d4b0818da6595e976991194ce96ce1214 /Libraries external
parent750bee9a483581a5bb3dde1676683210ca81511a (diff)
coding
Diffstat (limited to 'Libraries external')
-rwxr-xr-xLibraries external/PureLayout/ALView+PureLayout.h213
-rwxr-xr-xLibraries external/PureLayout/ALView+PureLayout.m848
-rwxr-xr-xLibraries external/PureLayout/NSArray+PureLayout.h115
-rwxr-xr-xLibraries external/PureLayout/NSArray+PureLayout.m505
-rwxr-xr-xLibraries external/PureLayout/NSLayoutConstraint+PureLayout.h84
-rwxr-xr-xLibraries external/PureLayout/NSLayoutConstraint+PureLayout.m552
-rwxr-xr-xLibraries external/PureLayout/PureLayout+Internal.h87
-rwxr-xr-xLibraries external/PureLayout/PureLayout.h43
-rwxr-xr-xLibraries external/PureLayout/PureLayoutDefines.h224
9 files changed, 0 insertions, 2671 deletions
diff --git a/Libraries external/PureLayout/ALView+PureLayout.h b/Libraries external/PureLayout/ALView+PureLayout.h
deleted file mode 100755
index 6e6101455..000000000
--- a/Libraries external/PureLayout/ALView+PureLayout.h
+++ /dev/null
@@ -1,213 +0,0 @@
-//
-// ALView+PureLayout.h
-// https://github.com/PureLayout/PureLayout
-//
-// Copyright (c) 2012 Richard Turton
-// Copyright (c) 2013-2015 Tyler Fox
-//
-// This code is distributed under the terms and conditions of the MIT license.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//
-
-#import "PureLayoutDefines.h"
-
-
-PL__ASSUME_NONNULL_BEGIN
-
-#pragma mark ALView+PureLayout
-
-/**
- A category on UIView/NSView that provides a simple yet powerful interface for creating Auto Layout constraints.
- */
-@interface ALView (PureLayout)
-
-
-#pragma mark Factory & Initializer Methods
-
-/** Creates and returns a new view that does not convert the autoresizing mask into constraints. */
-+ (instancetype)newAutoLayoutView;
-
-/** Initializes and returns a new view that does not convert the autoresizing mask into constraints. */
-- (instancetype)initForAutoLayout;
-
-/** Configures an existing view to not convert the autoresizing mask into constraints and returns the view. */
-- (instancetype)configureForAutoLayout;
-
-
-#pragma mark Center & Align in Superview
-
-/** Centers the view in its superview. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoCenterInSuperview;
-
-/** Aligns the view to the same axis of its superview. */
-- (NSLayoutConstraint *)autoAlignAxisToSuperviewAxis:(ALAxis)axis;
-
-#if PL__PureLayout_MinBaseSDK_iOS_8_0
-
-/** Centers the view in its superview's margins. Available in iOS 8.0 and later. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoCenterInSuperviewMargins;
-
-/** Aligns the view to the corresponding margin axis of its superview. Available in iOS 8.0 and later. */
-- (NSLayoutConstraint *)autoAlignAxisToSuperviewMarginAxis:(ALAxis)axis;
-
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 */
-
-
-#pragma mark Pin Edges to Superview
-
-/** Pins the given edge of the view to the same edge of its superview. */
-- (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge;
-
-/** Pins the given edge of the view to the same edge of its superview with an inset. */
-- (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge withInset:(CGFloat)inset;
-
-/** Pins the given edge of the view to the same edge of its superview with an inset as a maximum or minimum. */
-- (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge withInset:(CGFloat)inset relation:(NSLayoutRelation)relation;
-
-/** Pins the edges of the view to the edges of its superview. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoPinEdgesToSuperviewEdges;
-
-/** Pins the edges of the view to the edges of its superview with the given edge insets. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoPinEdgesToSuperviewEdgesWithInsets:(ALEdgeInsets)insets;
-
-/** Pins 3 of the 4 edges of the view to the edges of its superview with the given edge insets, excluding one edge. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoPinEdgesToSuperviewEdgesWithInsets:(ALEdgeInsets)insets excludingEdge:(ALEdge)edge;
-
-#if PL__PureLayout_MinBaseSDK_iOS_8_0
-
-/** Pins the given edge of the view to the corresponding margin of its superview. Available in iOS 8.0 and later. */
-- (NSLayoutConstraint *)autoPinEdgeToSuperviewMargin:(ALEdge)edge;
-
-/** Pins the given edge of the view to the corresponding margin of its superview as a maximum or minimum. Available in iOS 8.0 and later. */
-- (NSLayoutConstraint *)autoPinEdgeToSuperviewMargin:(ALEdge)edge relation:(NSLayoutRelation)relation;
-
-/** Pins the edges of the view to the margins of its superview. Available in iOS 8.0 and later. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoPinEdgesToSuperviewMargins;
-
-/** Pins 3 of the 4 edges of the view to the margins of its superview excluding one edge. Available in iOS 8.0 and later. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoPinEdgesToSuperviewMarginsExcludingEdge:(ALEdge)edge;
-
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 */
-
-
-#pragma mark Pin Edges
-
-/** Pins an edge of the view to a given edge of another view. */
-- (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(ALView *)otherView;
-
-/** Pins an edge of the view to a given edge of another view with an offset. */
-- (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(ALView *)otherView withOffset:(CGFloat)offset;
-
-/** Pins an edge of the view to a given edge of another view with an offset as a maximum or minimum. */
-- (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(ALView *)otherView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation;
-
-
-#pragma mark Align Axes
-
-/** Aligns an axis of the view to the same axis of another view. */
-- (NSLayoutConstraint *)autoAlignAxis:(ALAxis)axis toSameAxisOfView:(ALView *)otherView;
-
-/** Aligns an axis of the view to the same axis of another view with an offset. */
-- (NSLayoutConstraint *)autoAlignAxis:(ALAxis)axis toSameAxisOfView:(ALView *)otherView withOffset:(CGFloat)offset;
-
-/** Aligns an axis of the view to the same axis of another view with a multiplier. */
-- (NSLayoutConstraint *)autoAlignAxis:(ALAxis)axis toSameAxisOfView:(ALView *)otherView withMultiplier:(CGFloat)multiplier;
-
-
-#pragma mark Match Dimensions
-
-/** Matches a dimension of the view to a given dimension of another view. */
-- (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView;
-
-/** Matches a dimension of the view to a given dimension of another view with an offset. */
-- (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView withOffset:(CGFloat)offset;
-
-/** Matches a dimension of the view to a given dimension of another view with an offset as a maximum or minimum. */
-- (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation;
-
-/** Matches a dimension of the view to a multiple of a given dimension of another view. */
-- (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView withMultiplier:(CGFloat)multiplier;
-
-/** Matches a dimension of the view to a multiple of a given dimension of another view as a maximum or minimum. */
-- (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView withMultiplier:(CGFloat)multiplier relation:(NSLayoutRelation)relation;
-
-
-#pragma mark Set Dimensions
-
-/** Sets the view to a specific size. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoSetDimensionsToSize:(CGSize)size;
-
-/** Sets the given dimension of the view to a specific size. */
-- (NSLayoutConstraint *)autoSetDimension:(ALDimension)dimension toSize:(CGFloat)size;
-
-/** Sets the given dimension of the view to a specific size as a maximum or minimum. */
-- (NSLayoutConstraint *)autoSetDimension:(ALDimension)dimension toSize:(CGFloat)size relation:(NSLayoutRelation)relation;
-
-
-#pragma mark Set Content Compression Resistance & Hugging
-
-/** Sets the priority of content compression resistance for an axis.
- NOTE: This method must be called from within the block passed into the method +[NSLayoutConstraint autoSetPriority:forConstraints:] */
-- (void)autoSetContentCompressionResistancePriorityForAxis:(ALAxis)axis;
-
-/** Sets the priority of content hugging for an axis.
- NOTE: This method must be called from within the block passed into the method +[NSLayoutConstraint autoSetPriority:forConstraints:] */
-- (void)autoSetContentHuggingPriorityForAxis:(ALAxis)axis;
-
-
-#pragma mark Constrain Any Attributes
-
-/** Constrains an attribute of the view to a given attribute of another view. */
-- (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView;
-
-/** Constrains an attribute of the view to a given attribute of another view with an offset. */
-- (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView withOffset:(CGFloat)offset;
-
-/** Constrains an attribute of the view to a given attribute of another view with an offset as a maximum or minimum. */
-- (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation;
-
-/** Constrains an attribute of the view to a given attribute of another view with a multiplier. */
-- (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView withMultiplier:(CGFloat)multiplier;
-
-/** Constrains an attribute of the view to a given attribute of another view with a multiplier as a maximum or minimum. */
-- (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView withMultiplier:(CGFloat)multiplier relation:(NSLayoutRelation)relation;
-
-
-#pragma mark Pin to Layout Guides (iOS only)
-
-#if TARGET_OS_IPHONE
-
-/** Pins the top edge of the view to the top layout guide of the given view controller with an inset. Available on iOS only. */
-- (NSLayoutConstraint *)autoPinToTopLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset;
-
-/** Pins the top edge of the view to the top layout guide of the given view controller with an inset as a maximum or minimum. Available on iOS only. */
-- (NSLayoutConstraint *)autoPinToTopLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset relation:(NSLayoutRelation)relation;
-
-/** Pins the bottom edge of the view to the bottom layout guide of the given view controller with an inset. Available on iOS only. */
-- (NSLayoutConstraint *)autoPinToBottomLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset;
-
-/** Pins the bottom edge of the view to the bottom layout guide of the given view controller with an inset as a maximum or minimum. Available on iOS only. */
-- (NSLayoutConstraint *)autoPinToBottomLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset relation:(NSLayoutRelation)relation;
-
-#endif /* TARGET_OS_IPHONE */
-
-@end
-
-PL__ASSUME_NONNULL_END
diff --git a/Libraries external/PureLayout/ALView+PureLayout.m b/Libraries external/PureLayout/ALView+PureLayout.m
deleted file mode 100755
index 2e946625f..000000000
--- a/Libraries external/PureLayout/ALView+PureLayout.m
+++ /dev/null
@@ -1,848 +0,0 @@
-//
-// ALView+PureLayout.m
-// https://github.com/PureLayout/PureLayout
-//
-// Copyright (c) 2012 Richard Turton
-// Copyright (c) 2013-2015 Tyler Fox
-//
-// This code is distributed under the terms and conditions of the MIT license.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//
-
-#import "ALView+PureLayout.h"
-#import "NSLayoutConstraint+PureLayout.h"
-#import "NSArray+PureLayout.h"
-#import "PureLayout+Internal.h"
-
-
-#pragma mark - ALView+PureLayout
-
-@implementation ALView (PureLayout)
-
-
-#pragma mark Factory & Initializer Methods
-
-/**
- Creates and returns a new view that does not convert the autoresizing mask into constraints.
- */
-+ (instancetype)newAutoLayoutView
-{
- ALView *view = [self new];
- view.translatesAutoresizingMaskIntoConstraints = NO;
- return view;
-}
-
-/**
- Initializes and returns a new view that does not convert the autoresizing mask into constraints.
- */
-- (instancetype)initForAutoLayout
-{
- self = [self init];
- if (self) {
- self.translatesAutoresizingMaskIntoConstraints = NO;
- }
- return self;
-}
-
-/**
- Configures an existing view to not convert the autoresizing mask into constraints and returns the view.
- */
-- (instancetype)configureForAutoLayout
-{
- self.translatesAutoresizingMaskIntoConstraints = NO;
- return self;
-}
-
-
-#pragma mark Center in Superview
-
-/**
- Centers the view in its superview.
-
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoCenterInSuperview
-{
- PL__NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new];
- [constraints addObject:[self autoAlignAxisToSuperviewAxis:ALAxisHorizontal]];
- [constraints addObject:[self autoAlignAxisToSuperviewAxis:ALAxisVertical]];
- return constraints;
-}
-
-/**
- Aligns the view to the same axis of its superview.
-
- @param axis The axis of this view and of its superview to align.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoAlignAxisToSuperviewAxis:(ALAxis)axis
-{
- self.translatesAutoresizingMaskIntoConstraints = NO;
- ALView *superview = self.superview;
- NSAssert(superview, @"View's superview must not be nil.\nView: %@", self);
- return [self autoConstrainAttribute:(ALAttribute)axis toAttribute:(ALAttribute)axis ofView:superview];
-}
-
-#if PL__PureLayout_MinBaseSDK_iOS_8_0
-
-/**
- Centers the view in its superview, taking into account the layout margins of both the view and its superview.
-
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoCenterInSuperviewMargins
-{
- PL__NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new];
- [constraints addObject:[self autoAlignAxisToSuperviewMarginAxis:ALAxisHorizontal]];
- [constraints addObject:[self autoAlignAxisToSuperviewMarginAxis:ALAxisVertical]];
- return constraints;
-}
-
-/**
- Aligns the view to the corresponding margin axis of its superview.
-
- @param axis The axis of this view to align to the corresponding margin axis of its superview.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoAlignAxisToSuperviewMarginAxis:(ALAxis)axis
-{
- self.translatesAutoresizingMaskIntoConstraints = NO;
- ALView *superview = self.superview;
- NSAssert(superview, @"View's superview must not be nil.\nView: %@", self);
- ALMarginAxis marginAxis = [NSLayoutConstraint al_marginAxisForAxis:axis];
- return [self autoConstrainAttribute:(ALAttribute)axis toAttribute:(ALAttribute)marginAxis ofView:superview];
-}
-
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 */
-
-
-#pragma mark Pin Edges to Superview
-
-/**
- Pins the given edge of the view to the same edge of its superview.
-
- @param edge The edge of this view and its superview to pin.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge
-{
- return [self autoPinEdgeToSuperviewEdge:edge withInset:0.0];
-}
-
-/**
- Pins the given edge of the view to the same edge of its superview with an inset.
-
- @param edge The edge of this view and its superview to pin.
- @param inset The amount to inset this view's edge from the superview's edge.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge withInset:(CGFloat)inset
-{
- return [self autoPinEdgeToSuperviewEdge:edge withInset:inset relation:NSLayoutRelationEqual];
-}
-
-/**
- Pins the given edge of the view to the same edge of its superview with an inset as a maximum or minimum.
-
- @param edge The edge of this view and its superview to pin.
- @param inset The amount to inset this view's edge from the superview's edge.
- @param relation Whether the inset should be at least, at most, or exactly equal to the given value.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge withInset:(CGFloat)inset relation:(NSLayoutRelation)relation
-{
- self.translatesAutoresizingMaskIntoConstraints = NO;
- ALView *superview = self.superview;
- NSAssert(superview, @"View's superview must not be nil.\nView: %@", self);
- if (edge == ALEdgeBottom || edge == ALEdgeRight || edge == ALEdgeTrailing) {
- // The bottom, right, and trailing insets (and relations, if an inequality) are inverted to become offsets
- inset = -inset;
- if (relation == NSLayoutRelationLessThanOrEqual) {
- relation = NSLayoutRelationGreaterThanOrEqual;
- } else if (relation == NSLayoutRelationGreaterThanOrEqual) {
- relation = NSLayoutRelationLessThanOrEqual;
- }
- }
- return [self autoPinEdge:edge toEdge:edge ofView:superview withOffset:inset relation:relation];
-}
-
-/**
- Pins the edges of the view to the edges of its superview.
-
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoPinEdgesToSuperviewEdges
-{
- return [self autoPinEdgesToSuperviewEdgesWithInsets:ALEdgeInsetsZero];
-}
-
-/**
- Pins the edges of the view to the edges of its superview with the given edge insets.
- The insets.left corresponds to a leading edge constraint, and insets.right corresponds to a trailing edge constraint.
-
- @param insets The insets for this view's edges from its superview's edges.
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoPinEdgesToSuperviewEdgesWithInsets:(ALEdgeInsets)insets
-{
- PL__NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new];
- [constraints addObject:[self autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:insets.top]];
- [constraints addObject:[self autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:insets.left]];
- [constraints addObject:[self autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:insets.bottom]];
- [constraints addObject:[self autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:insets.right]];
- return constraints;
-}
-
-/**
- Pins 3 of the 4 edges of the view to the edges of its superview with the given edge insets, excluding one edge.
- The insets.left corresponds to a leading edge constraint, and insets.right corresponds to a trailing edge constraint.
-
- @param insets The insets for this view's edges from its superview's edges. The inset corresponding to the excluded edge
- will be ignored.
- @param edge The edge of this view to exclude in pinning to its superview; this method will not apply any constraint to it.
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoPinEdgesToSuperviewEdgesWithInsets:(ALEdgeInsets)insets excludingEdge:(ALEdge)edge
-{
- PL__NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new];
- if (edge != ALEdgeTop) {
- [constraints addObject:[self autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:insets.top]];
- }
- if (edge != ALEdgeLeading && edge != ALEdgeLeft) {
- [constraints addObject:[self autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:insets.left]];
- }
- if (edge != ALEdgeBottom) {
- [constraints addObject:[self autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:insets.bottom]];
- }
- if (edge != ALEdgeTrailing && edge != ALEdgeRight) {
- [constraints addObject:[self autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:insets.right]];
- }
- return constraints;
-}
-
-#if PL__PureLayout_MinBaseSDK_iOS_8_0
-
-/**
- Pins the given edge of the view to the corresponding margin of its superview.
-
- @param edge The edge of this view to pin to the corresponding margin of its superview.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoPinEdgeToSuperviewMargin:(ALEdge)edge
-{
- return [self autoPinEdgeToSuperviewMargin:edge relation:NSLayoutRelationEqual];
-}
-
-/**
- Pins the given edge of the view to the corresponding margin of its superview as a maximum or minimum.
-
- @param edge The edge of this view to pin to the corresponding margin of its superview.
- @param relation Whether the edge should be inset by at least, at most, or exactly the superview's margin.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoPinEdgeToSuperviewMargin:(ALEdge)edge relation:(NSLayoutRelation)relation
-{
- self.translatesAutoresizingMaskIntoConstraints = NO;
- ALView *superview = self.superview;
- NSAssert(superview, @"View's superview must not be nil.\nView: %@", self);
- if (edge == ALEdgeBottom || edge == ALEdgeRight || edge == ALEdgeTrailing) {
- // The bottom, right, and trailing relations are inverted
- if (relation == NSLayoutRelationLessThanOrEqual) {
- relation = NSLayoutRelationGreaterThanOrEqual;
- } else if (relation == NSLayoutRelationGreaterThanOrEqual) {
- relation = NSLayoutRelationLessThanOrEqual;
- }
- }
- ALMargin margin = [NSLayoutConstraint al_marginForEdge:edge];
- return [self autoConstrainAttribute:(ALAttribute)edge toAttribute:(ALAttribute)margin ofView:superview withOffset:0.0 relation:relation];
-}
-
-/**
- Pins the edges of the view to the margins of its superview.
-
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoPinEdgesToSuperviewMargins
-{
- PL__NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new];
- [constraints addObject:[self autoPinEdgeToSuperviewMargin:ALEdgeTop]];
- [constraints addObject:[self autoPinEdgeToSuperviewMargin:ALEdgeLeading]];
- [constraints addObject:[self autoPinEdgeToSuperviewMargin:ALEdgeBottom]];
- [constraints addObject:[self autoPinEdgeToSuperviewMargin:ALEdgeTrailing]];
- return constraints;
-}
-
-/**
- Pins 3 of the 4 edges of the view to the margins of its superview, excluding one edge.
-
- @param edge The edge of this view to exclude in pinning to its superview; this method will not apply any constraint to it.
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoPinEdgesToSuperviewMarginsExcludingEdge:(ALEdge)edge
-{
- PL__NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new];
- if (edge != ALEdgeTop) {
- [constraints addObject:[self autoPinEdgeToSuperviewMargin:ALEdgeTop]];
- }
- if (edge != ALEdgeLeading && edge != ALEdgeLeft) {
- [constraints addObject:[self autoPinEdgeToSuperviewMargin:ALEdgeLeading]];
- }
- if (edge != ALEdgeBottom) {
- [constraints addObject:[self autoPinEdgeToSuperviewMargin:ALEdgeBottom]];
- }
- if (edge != ALEdgeTrailing && edge != ALEdgeRight) {
- [constraints addObject:[self autoPinEdgeToSuperviewMargin:ALEdgeTrailing]];
- }
- return constraints;
-}
-
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 */
-
-
-#pragma mark Pin Edges
-
-/**
- Pins an edge of the view to a given edge of another view.
-
- @param edge The edge of this view to pin.
- @param toEdge The edge of the other view to pin to.
- @param otherView The other view to pin to. Must be in the same view hierarchy as this view.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(ALView *)otherView
-{
- return [self autoPinEdge:edge toEdge:toEdge ofView:otherView withOffset:0.0];
-}
-
-/**
- Pins an edge of the view to a given edge of another view with an offset.
-
- @param edge The edge of this view to pin.
- @param toEdge The edge of the other view to pin to.
- @param otherView The other view to pin to. Must be in the same view hierarchy as this view.
- @param offset The offset between the edge of this view and the edge of the other view.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(ALView *)otherView withOffset:(CGFloat)offset
-{
- return [self autoPinEdge:edge toEdge:toEdge ofView:otherView withOffset:offset relation:NSLayoutRelationEqual];
-}
-
-/**
- Pins an edge of the view to a given edge of another view with an offset as a maximum or minimum.
-
- @param edge The edge of this view to pin.
- @param toEdge The edge of the other view to pin to.
- @param otherView The other view to pin to. Must be in the same view hierarchy as this view.
- @param offset The offset between the edge of this view and the edge of the other view.
- @param relation Whether the offset should be at least, at most, or exactly equal to the given value.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(ALView *)otherView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation
-{
- return [self autoConstrainAttribute:(ALAttribute)edge toAttribute:(ALAttribute)toEdge ofView:otherView withOffset:offset relation:relation];
-}
-
-
-#pragma mark Align Axes
-
-/**
- Aligns an axis of the view to the same axis of another view.
-
- @param axis The axis of this view and the other view to align.
- @param otherView The other view to align to. Must be in the same view hierarchy as this view.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoAlignAxis:(ALAxis)axis toSameAxisOfView:(ALView *)otherView
-{
- return [self autoAlignAxis:axis toSameAxisOfView:otherView withOffset:0.0];
-}
-
-/**
- Aligns an axis of the view to the same axis of another view with an offset.
-
- @param axis The axis of this view and the other view to align.
- @param otherView The other view to align to. Must be in the same view hierarchy as this view.
- @param offset The offset between the axis of this view and the axis of the other view.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoAlignAxis:(ALAxis)axis toSameAxisOfView:(ALView *)otherView withOffset:(CGFloat)offset
-{
- return [self autoConstrainAttribute:(ALAttribute)axis toAttribute:(ALAttribute)axis ofView:otherView withOffset:offset];
-}
-
-/**
- Aligns an axis of the view to the same axis of another view with a multiplier.
-
- @param axis The axis of this view and the other view to align.
- @param otherView The other view to align to. Must be in the same view hierarchy as this view.
- @param multiplier The multiplier between the axis of this view and the axis of the other view.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoAlignAxis:(ALAxis)axis toSameAxisOfView:(ALView *)otherView withMultiplier:(CGFloat)multiplier
-{
- return [self autoConstrainAttribute:(ALAttribute)axis toAttribute:(ALAttribute)axis ofView:otherView withMultiplier:multiplier];
-}
-
-
-#pragma mark Match Dimensions
-
-/**
- Matches a dimension of the view to a given dimension of another view.
-
- @param dimension The dimension of this view to pin.
- @param toDimension The dimension of the other view to pin to.
- @param otherView The other view to match to. Must be in the same view hierarchy as this view.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView
-{
- return [self autoMatchDimension:dimension toDimension:toDimension ofView:otherView withOffset:0.0];
-}
-
-/**
- Matches a dimension of the view to a given dimension of another view with an offset.
-
- @param dimension The dimension of this view to pin.
- @param toDimension The dimension of the other view to pin to.
- @param otherView The other view to match to. Must be in the same view hierarchy as this view.
- @param offset The offset between the dimension of this view and the dimension of the other view.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView withOffset:(CGFloat)offset
-{
- return [self autoMatchDimension:dimension toDimension:toDimension ofView:otherView withOffset:offset relation:NSLayoutRelationEqual];
-}
-
-/**
- Matches a dimension of the view to a given dimension of another view with an offset as a maximum or minimum.
-
- @param dimension The dimension of this view to pin.
- @param toDimension The dimension of the other view to pin to.
- @param otherView The other view to match to. Must be in the same view hierarchy as this view.
- @param offset The offset between the dimension of this view and the dimension of the other view.
- @param relation Whether the offset should be at least, at most, or exactly equal to the given value.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation
-{
- return [self autoConstrainAttribute:(ALAttribute)dimension toAttribute:(ALAttribute)toDimension ofView:otherView withOffset:offset relation:relation];
-}
-
-/**
- Matches a dimension of the view to a multiple of a given dimension of another view.
-
- @param dimension The dimension of this view to pin.
- @param toDimension The dimension of the other view to pin to.
- @param otherView The other view to match to. Must be in the same view hierarchy as this view.
- @param multiplier The multiple of the other view's given dimension that this view's given dimension should be.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView withMultiplier:(CGFloat)multiplier
-{
- return [self autoMatchDimension:dimension toDimension:toDimension ofView:otherView withMultiplier:multiplier relation:NSLayoutRelationEqual];
-}
-
-/**
- Matches a dimension of the view to a multiple of a given dimension of another view as a maximum or minimum.
-
- @param dimension The dimension of this view to pin.
- @param toDimension The dimension of the other view to pin to.
- @param otherView The other view to match to. Must be in the same view hierarchy as this view.
- @param multiplier The multiple of the other view's given dimension that this view's given dimension should be.
- @param relation Whether the multiple should be at least, at most, or exactly equal to the given value.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(ALView *)otherView withMultiplier:(CGFloat)multiplier relation:(NSLayoutRelation)relation
-{
- return [self autoConstrainAttribute:(ALAttribute)dimension toAttribute:(ALAttribute)toDimension ofView:otherView withMultiplier:multiplier relation:relation];
-}
-
-
-#pragma mark Set Dimensions
-
-/**
- Sets the view to a specific size.
-
- @param size The size to set this view's dimensions to.
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoSetDimensionsToSize:(CGSize)size
-{
- PL__NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new];
- [constraints addObject:[self autoSetDimension:ALDimensionWidth toSize:size.width]];
- [constraints addObject:[self autoSetDimension:ALDimensionHeight toSize:size.height]];
- return constraints;
-}
-
-/**
- Sets the given dimension of the view to a specific size.
-
- @param dimension The dimension of this view to set.
- @param size The size to set the given dimension to.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoSetDimension:(ALDimension)dimension toSize:(CGFloat)size
-{
- return [self autoSetDimension:dimension toSize:size relation:NSLayoutRelationEqual];
-}
-
-/**
- Sets the given dimension of the view to a specific size as a maximum or minimum.
-
- @param dimension The dimension of this view to set.
- @param size The size to set the given dimension to.
- @param relation Whether the size should be at least, at most, or exactly equal to the given value.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoSetDimension:(ALDimension)dimension toSize:(CGFloat)size relation:(NSLayoutRelation)relation
-{
- self.translatesAutoresizingMaskIntoConstraints = NO;
- NSLayoutAttribute layoutAttribute = [NSLayoutConstraint al_layoutAttributeForAttribute:(ALAttribute)dimension];
- NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:self attribute:layoutAttribute relatedBy:relation toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:0.0 constant:size];
- [constraint autoInstall];
- return constraint;
-}
-
-
-#pragma mark Set Content Compression Resistance & Hugging
-
-/**
- Sets the priority of content compression resistance for an axis.
- NOTE: This method must be called from within the block passed into the method +[autoSetPriority:forConstraints:]
-
- @param axis The axis to set the content compression resistance priority for.
- */
-- (void)autoSetContentCompressionResistancePriorityForAxis:(ALAxis)axis
-{
- NSAssert([NSLayoutConstraint al_isExecutingPriorityConstraintsBlock], @"%@ should only be called from within the block passed into the method +[autoSetPriority:forConstraints:]", NSStringFromSelector(_cmd));
- if ([NSLayoutConstraint al_isExecutingPriorityConstraintsBlock]) {
- self.translatesAutoresizingMaskIntoConstraints = NO;
- ALLayoutConstraintAxis constraintAxis = [NSLayoutConstraint al_constraintAxisForAxis:axis];
-#if TARGET_OS_IPHONE
- [self setContentCompressionResistancePriority:[NSLayoutConstraint al_currentGlobalConstraintPriority] forAxis:constraintAxis];
-#else
- [self setContentCompressionResistancePriority:[NSLayoutConstraint al_currentGlobalConstraintPriority] forOrientation:constraintAxis];
-#endif /* TARGET_OS_IPHONE */
- }
-}
-
-/**
- Sets the priority of content hugging for an axis.
- NOTE: This method must be called from within the block passed into the method +[autoSetPriority:forConstraints:]
-
- @param axis The axis to set the content hugging priority for.
- */
-- (void)autoSetContentHuggingPriorityForAxis:(ALAxis)axis
-{
- NSAssert([NSLayoutConstraint al_isExecutingPriorityConstraintsBlock], @"%@ should only be called from within the block passed into the method +[autoSetPriority:forConstraints:]", NSStringFromSelector(_cmd));
- if ([NSLayoutConstraint al_isExecutingPriorityConstraintsBlock]) {
- self.translatesAutoresizingMaskIntoConstraints = NO;
- ALLayoutConstraintAxis constraintAxis = [NSLayoutConstraint al_constraintAxisForAxis:axis];
-#if TARGET_OS_IPHONE
- [self setContentHuggingPriority:[NSLayoutConstraint al_currentGlobalConstraintPriority] forAxis:constraintAxis];
-#else
- [self setContentHuggingPriority:[NSLayoutConstraint al_currentGlobalConstraintPriority] forOrientation:constraintAxis];
-#endif /* TARGET_OS_IPHONE */
- }
-}
-
-
-#pragma mark Constrain Any Attributes
-
-/**
- Constrains an attribute of the view to a given attribute of another view.
- This method can be used to constrain different types of attributes across two views.
-
- @param attribute Any attribute of this view to constrain.
- @param toAttribute Any attribute of the other view to constrain to.
- @param otherView The other view to constrain to. Must be in the same view hierarchy as this view.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView
-{
- return [self autoConstrainAttribute:attribute toAttribute:toAttribute ofView:otherView withOffset:0.0];
-}
-
-/**
- Constrains an attribute of the view to a given attribute of another view with an offset.
- This method can be used to constrain different types of attributes across two views.
-
- @param attribute Any attribute of this view to constrain.
- @param toAttribute Any attribute of the other view to constrain to.
- @param otherView The other view to constrain to. Must be in the same view hierarchy as this view.
- @param offset The offset between the attribute of this view and the attribute of the other view.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView withOffset:(CGFloat)offset
-{
- return [self autoConstrainAttribute:attribute toAttribute:toAttribute ofView:otherView withOffset:offset relation:NSLayoutRelationEqual];
-}
-
-/**
- Constrains an attribute of the view to a given attribute of another view with an offset as a maximum or minimum.
- This method can be used to constrain different types of attributes across two views.
-
- @param attribute Any attribute of this view to constrain.
- @param toAttribute Any attribute of the other view to constrain to.
- @param otherView The other view to constrain to. Must be in the same view hierarchy as this view.
- @param offset The offset between the attribute of this view and the attribute of the other view.
- @param relation Whether the offset should be at least, at most, or exactly equal to the given value.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation
-{
- self.translatesAutoresizingMaskIntoConstraints = NO;
- NSLayoutAttribute layoutAttribute = [NSLayoutConstraint al_layoutAttributeForAttribute:attribute];
- NSLayoutAttribute toLayoutAttribute = [NSLayoutConstraint al_layoutAttributeForAttribute:toAttribute];
- NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:self attribute:layoutAttribute relatedBy:relation toItem:otherView attribute:toLayoutAttribute multiplier:1.0 constant:offset];
- [constraint autoInstall];
- return constraint;
-}
-
-/**
- Constrains an attribute of the view to a given attribute of another view with a multiplier.
- This method can be used to constrain different types of attributes across two views.
-
- @param attribute Any attribute of this view to constrain.
- @param toAttribute Any attribute of the other view to constrain to.
- @param otherView The other view to constrain to. Must be in the same view hierarchy as this view.
- @param multiplier The multiplier between the attribute of this view and the attribute of the other view.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView withMultiplier:(CGFloat)multiplier
-{
- return [self autoConstrainAttribute:attribute toAttribute:toAttribute ofView:otherView withMultiplier:multiplier relation:NSLayoutRelationEqual];
-}
-
-/**
- Constrains an attribute of the view to a given attribute of another view with a multiplier as a maximum or minimum.
- This method can be used to constrain different types of attributes across two views.
-
- @param attribute Any attribute of this view to constrain.
- @param toAttribute Any attribute of the other view to constrain to.
- @param otherView The other view to constrain to. Must be in the same view hierarchy as this view.
- @param multiplier The multiplier between the attribute of this view and the attribute of the other view.
- @param relation Whether the multiplier should be at least, at most, or exactly equal to the given value.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoConstrainAttribute:(ALAttribute)attribute toAttribute:(ALAttribute)toAttribute ofView:(ALView *)otherView withMultiplier:(CGFloat)multiplier relation:(NSLayoutRelation)relation
-{
- self.translatesAutoresizingMaskIntoConstraints = NO;
- NSLayoutAttribute layoutAttribute = [NSLayoutConstraint al_layoutAttributeForAttribute:attribute];
- NSLayoutAttribute toLayoutAttribute = [NSLayoutConstraint al_layoutAttributeForAttribute:toAttribute];
- NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:self attribute:layoutAttribute relatedBy:relation toItem:otherView attribute:toLayoutAttribute multiplier:multiplier constant:0.0];
- [constraint autoInstall];
- return constraint;
-}
-
-
-#pragma mark Pin to Layout Guides
-
-#if TARGET_OS_IPHONE
-
-/**
- Pins the top edge of the view to the top layout guide of the given view controller with an inset.
- For compatibility with iOS 6 (where layout guides do not exist), this method will simply pin the top edge of
- the view to the top edge of the given view controller's view with an inset.
-
- @param viewController The view controller whose topLayoutGuide should be used to pin to.
- @param inset The amount to inset this view's top edge from the layout guide.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoPinToTopLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset
-{
- return [self autoPinToTopLayoutGuideOfViewController:viewController withInset:inset relation:NSLayoutRelationEqual];
-}
-
-- (NSLayoutConstraint *)autoPinToTopLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset relation:(NSLayoutRelation)relation
-{
- if (PL__PureLayout_MinSysVer_iOS_7_0) {
- self.translatesAutoresizingMaskIntoConstraints = NO;
- NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeTop relatedBy:relation toItem:viewController.topLayoutGuide attribute:NSLayoutAttributeBottom multiplier:1.0 constant:inset];
- [viewController.view al_addConstraint:constraint]; // Can't use autoInstall because the layout guide is not a view
- return constraint;
- } else {
- // iOS 6 fallback
- return [self autoPinEdge:ALEdgeTop toEdge:ALEdgeTop ofView:viewController.view withOffset:inset relation:relation];
- }
-}
-
-/**
- Pins the bottom edge of the view to the bottom layout guide of the given view controller with an inset.
- For compatibility with iOS 6 (where layout guides do not exist), this method will simply pin the bottom edge of
- the view to the bottom edge of the given view controller's view with an inset.
-
- @param viewController The view controller whose bottomLayoutGuide should be used to pin to.
- @param inset The amount to inset this view's bottom edge from the layout guide.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)autoPinToBottomLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset
-{
- return [self autoPinToBottomLayoutGuideOfViewController:viewController withInset:inset relation:NSLayoutRelationEqual];
-}
-
-- (NSLayoutConstraint *)autoPinToBottomLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset relation:(NSLayoutRelation)relation
-{
- // The bottom inset (and relation, if an inequality) is inverted to become an offset
- inset = -inset;
- if (relation == NSLayoutRelationLessThanOrEqual) {
- relation = NSLayoutRelationGreaterThanOrEqual;
- } else if (relation == NSLayoutRelationGreaterThanOrEqual) {
- relation = NSLayoutRelationLessThanOrEqual;
- }
- if (PL__PureLayout_MinSysVer_iOS_7_0) {
- self.translatesAutoresizingMaskIntoConstraints = NO;
- NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeBottom relatedBy:relation toItem:viewController.bottomLayoutGuide attribute:NSLayoutAttributeTop multiplier:1.0 constant:inset];
- [viewController.view al_addConstraint:constraint]; // Can't use autoInstall because the layout guide is not a view
- return constraint;
- } else {
- // iOS 6 fallback
- return [self autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:viewController.view withOffset:inset relation:relation];
- }
-}
-
-#endif /* TARGET_OS_IPHONE */
-
-
-#pragma mark Internal Methods
-
-/**
- Adds the given constraint to this view after applying the global state to the constraint.
- NOTE: This method is compatible with all versions of iOS, and should be used for older versions before the active
- property on NSLayoutConstraint was introduced.
-
- This method should be the only one that calls the UIView/NSView addConstraint: method directly.
-
- @param constraint The constraint to set the global priority on and then add to this view.
- */
-- (void)al_addConstraint:(NSLayoutConstraint *)constraint
-{
- [NSLayoutConstraint al_applyGlobalStateToConstraint:constraint];
- if ([NSLayoutConstraint al_preventAutomaticConstraintInstallation]) {
- [[NSLayoutConstraint al_currentArrayOfCreatedConstraints] addObject:constraint];
- } else {
- [self addConstraint:constraint];
- }
-}
-
-/**
- Returns the common superview for this view and the given other view.
- Raises an exception if this view and the other view do not share a common superview.
-
- @return The common superview for the two views.
- */
-- (ALView *)al_commonSuperviewWithView:(ALView *)otherView
-{
- ALView *commonSuperview = nil;
- ALView *startView = self;
- do {
-#if TARGET_OS_IPHONE
- if ([otherView isDescendantOfView:startView]) {
- commonSuperview = startView;
- }
-#else
- if ([otherView isDescendantOf:startView]) {
- commonSuperview = startView;
- }
-#endif /* TARGET_OS_IPHONE */
- startView = startView.superview;
- } while (startView && !commonSuperview);
- NSAssert(commonSuperview, @"Can't constrain two views that do not share a common superview. Make sure that both views have been added into the same view hierarchy.");
- return commonSuperview;
-}
-
-/**
- Aligns this view to another view with an alignment attribute.
-
- @param attribute The attribute to use to align the two views.
- @param otherView The other view to align to.
- @param axis The axis along which the views are distributed, used to validate the alignment attribute.
- @return The constraint added.
- */
-- (NSLayoutConstraint *)al_alignAttribute:(ALAttribute)attribute toView:(ALView *)otherView forAxis:(ALAxis)axis
-{
- NSLayoutConstraint *constraint = nil;
- switch (attribute) {
- case ALAttributeVertical:
- NSAssert(axis == ALAxisVertical, @"Cannot align views that are distributed horizontally with ALAttributeVertical.");
- constraint = [self autoAlignAxis:ALAxisVertical toSameAxisOfView:otherView];
- break;
- case ALAttributeHorizontal:
- NSAssert(axis != ALAxisVertical, @"Cannot align views that are distributed vertically with ALAttributeHorizontal.");
- constraint = [self autoAlignAxis:ALAxisHorizontal toSameAxisOfView:otherView];
- break;
- case ALAttributeBaseline: // same value as ALAttributeLastBaseline
- NSAssert(axis != ALAxisVertical, @"Cannot align views that are distributed vertically with ALAttributeBaseline.");
- constraint = [self autoAlignAxis:ALAxisBaseline toSameAxisOfView:otherView];
- break;
-#if PL__PureLayout_MinBaseSDK_iOS_8_0
- case ALAttributeFirstBaseline:
- NSAssert(PL__PureLayout_MinSysVer_iOS_8_0, @"ALAttributeFirstBaseline is only supported on iOS 8.0 or higher.");
- NSAssert(axis != ALAxisVertical, @"Cannot align views that are distributed vertically with ALAttributeFirstBaseline.");
- constraint = [self autoAlignAxis:ALAxisFirstBaseline toSameAxisOfView:otherView];
- break;
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 */
- case ALAttributeTop:
- NSAssert(axis != ALAxisVertical, @"Cannot align views that are distributed vertically with ALAttributeTop.");
- constraint = [self autoPinEdge:ALEdgeTop toEdge:ALEdgeTop ofView:otherView];
- break;
- case ALAttributeLeft:
- NSAssert(axis == ALAxisVertical, @"Cannot align views that are distributed horizontally with ALAttributeLeft.");
- constraint = [self autoPinEdge:ALEdgeLeft toEdge:ALEdgeLeft ofView:otherView];
- break;
- case ALAttributeBottom:
- NSAssert(axis != ALAxisVertical, @"Cannot align views that are distributed vertically with ALAttributeBottom.");
- constraint = [self autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:otherView];
- break;
- case ALAttributeRight:
- NSAssert(axis == ALAxisVertical, @"Cannot align views that are distributed horizontally with ALAttributeRight.");
- constraint = [self autoPinEdge:ALEdgeRight toEdge:ALEdgeRight ofView:otherView];
- break;
- case ALAttributeLeading:
- NSAssert(axis == ALAxisVertical, @"Cannot align views that are distributed horizontally with ALAttributeLeading.");
- constraint = [self autoPinEdge:ALEdgeLeading toEdge:ALEdgeLeading ofView:otherView];
- break;
- case ALAttributeTrailing:
- NSAssert(axis == ALAxisVertical, @"Cannot align views that are distributed horizontally with ALAttributeTrailing.");
- constraint = [self autoPinEdge:ALEdgeTrailing toEdge:ALEdgeTrailing ofView:otherView];
- break;
-
- // All of the below attributes are invalid as alignment options. Listing them explicitly (even though they just fall through to the default case) to avoid an incomplete switch statement warning from the compiler.
- case ALAttributeWidth:
- case ALAttributeHeight:
-#if PL__PureLayout_MinBaseSDK_iOS_8_0
- case ALAttributeMarginLeft:
- case ALAttributeMarginRight:
- case ALAttributeMarginTop:
- case ALAttributeMarginBottom:
- case ALAttributeMarginLeading:
- case ALAttributeMarginTrailing:
- case ALAttributeMarginAxisVertical:
- case ALAttributeMarginAxisHorizontal:
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 */
- default:
- NSAssert(nil, @"Unsupported attribute for alignment.");
- break;
- }
- return constraint;
-}
-
-@end
diff --git a/Libraries external/PureLayout/NSArray+PureLayout.h b/Libraries external/PureLayout/NSArray+PureLayout.h
deleted file mode 100755
index 682ef1b4a..000000000
--- a/Libraries external/PureLayout/NSArray+PureLayout.h
+++ /dev/null
@@ -1,115 +0,0 @@
-//
-// NSArray+PureLayout.h
-// https://github.com/PureLayout/PureLayout
-//
-// Copyright (c) 2012 Richard Turton
-// Copyright (c) 2013-2015 Tyler Fox
-//
-// This code is distributed under the terms and conditions of the MIT license.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//
-
-#import "PureLayoutDefines.h"
-
-
-PL__ASSUME_NONNULL_BEGIN
-
-#pragma mark NSArray+PureLayout
-
-/**
- A category on NSArray that provides a simple yet powerful interface to:
- - Manage an array of Auto Layout constraints
- - Apply constraints to an array of views
- */
-@interface NSArray (PureLayout)
-
-
-#pragma mark Array of Constraints
-
-/** Activates the constraints in this array. */
-- (void)autoInstallConstraints;
-
-/** Deactivates the constraints in this array. */
-- (void)autoRemoveConstraints;
-
-#if PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10
-
-/** Sets the string as the identifier for the constraints in this array. Available in iOS 7.0 and OS X 10.9 and later. */
-- (instancetype)autoIdentifyConstraints:(NSString *)identifier;
-
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10 */
-
-
-#pragma mark Array of Views
-
-/** Aligns views in this array to one another along a given edge. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoAlignViewsToEdge:(ALEdge)edge;
-
-/** Aligns views in this array to one another along a given axis. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoAlignViewsToAxis:(ALAxis)axis;
-
-/** Matches a given dimension of all the views in this array. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoMatchViewsDimension:(ALDimension)dimension;
-
-/** Sets the given dimension of all the views in this array to a given size. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoSetViewsDimension:(ALDimension)dimension toSize:(CGFloat)size;
-
-/** Sets all of the views in this array to a given size. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoSetViewsDimensionsToSize:(CGSize)size;
-
-
-/** Distributes the views in this array equally along the selected axis in their superview.
- Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis
- alignedTo:(ALAttribute)alignment
- withFixedSpacing:(CGFloat)spacing;
-
-/** Distributes the views in this array equally along the selected axis in their superview.
- Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them, with optional insets from the first and last views to their superview. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis
- alignedTo:(ALAttribute)alignment
- withFixedSpacing:(CGFloat)spacing
- insetSpacing:(BOOL)shouldSpaceInsets;
-
-/** Distributes the views in this array equally along the selected axis in their superview.
- Views will have spacing (fixed) between them, with optional insets from the first and last views to their superview, and optionally constrained to the same size in the dimension along the axis. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis
- alignedTo:(ALAttribute)alignment
- withFixedSpacing:(CGFloat)spacing
- insetSpacing:(BOOL)shouldSpaceInsets
- matchedSizes:(BOOL)shouldMatchSizes;
-
-
-/** Distributes the views in this array equally along the selected axis in their superview.
- Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis
- alignedTo:(ALAttribute)alignment
- withFixedSize:(CGFloat)size;
-
-/** Distributes the views in this array equally along the selected axis in their superview.
- Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them, with optional insets from the first and last views to their superview. */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis
- alignedTo:(ALAttribute)alignment
- withFixedSize:(CGFloat)size
- insetSpacing:(BOOL)shouldSpaceInsets;
-
-@end
-
-PL__ASSUME_NONNULL_END
diff --git a/Libraries external/PureLayout/NSArray+PureLayout.m b/Libraries external/PureLayout/NSArray+PureLayout.m
deleted file mode 100755
index 20106306d..000000000
--- a/Libraries external/PureLayout/NSArray+PureLayout.m
+++ /dev/null
@@ -1,505 +0,0 @@
-//
-// NSArray+PureLayout.m
-// https://github.com/PureLayout/PureLayout
-//
-// Copyright (c) 2012 Richard Turton
-// Copyright (c) 2013-2015 Tyler Fox
-//
-// This code is distributed under the terms and conditions of the MIT license.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//
-
-#import "NSArray+PureLayout.h"
-#import "ALView+PureLayout.h"
-#import "NSLayoutConstraint+PureLayout.h"
-#import "PureLayout+Internal.h"
-
-
-#pragma mark - NSArray+PureLayout
-
-@implementation NSArray (PureLayout)
-
-
-#pragma mark Array of Constraints
-
-/**
- Activates the constraints in this array.
- */
-- (void)autoInstallConstraints
-{
-#if PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10
- if ([NSLayoutConstraint respondsToSelector:@selector(activateConstraints:)]) {
- for (id object in self) {
- if ([object isKindOfClass:[NSLayoutConstraint class]]) {
- [NSLayoutConstraint al_applyGlobalStateToConstraint:object];
- }
- }
- if ([NSLayoutConstraint al_preventAutomaticConstraintInstallation]) {
- [[NSLayoutConstraint al_currentArrayOfCreatedConstraints] addObjectsFromArray:self];
- } else {
- [NSLayoutConstraint activateConstraints:self];
- }
- return;
- }
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10 */
-
- for (id object in self) {
- if ([object isKindOfClass:[NSLayoutConstraint class]]) {
- [((NSLayoutConstraint *)object) autoInstall];
- }
- }
-}
-
-/**
- Deactivates the constraints in this array.
- */
-- (void)autoRemoveConstraints
-{
-#if PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10
- if ([NSLayoutConstraint respondsToSelector:@selector(deactivateConstraints:)]) {
- [NSLayoutConstraint deactivateConstraints:self];
- return;
- }
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10 */
-
- for (id object in self) {
- if ([object isKindOfClass:[NSLayoutConstraint class]]) {
- [((NSLayoutConstraint *)object) autoRemove];
- }
- }
-}
-
-#if PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10
-
-/**
- Sets the string as the identifier for the constraints in this array. Available in iOS 7.0 and OS X 10.9 and later.
- The identifier will be printed along with each constraint's description.
- This is helpful to document the constraints' purpose and aid in debugging.
-
- @param identifier A string used to identify the constraints in this array.
- @return This array.
- */
-- (instancetype)autoIdentifyConstraints:(NSString *)identifier
-{
- for (id object in self) {
- if ([object isKindOfClass:[NSLayoutConstraint class]]) {
- [((NSLayoutConstraint *)object) autoIdentify:identifier];
- }
- }
- return self;
-}
-
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10 */
-
-
-#pragma mark Array of Views
-
-/**
- Aligns views in this array to one another along a given edge.
- Note: This array must contain at least 2 views, and all views must share a common superview.
-
- @param edge The edge to which the views will be aligned.
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoAlignViewsToEdge:(ALEdge)edge
-{
- NSAssert([self al_containsMinimumNumberOfViews:2], @"This array must contain at least 2 views.");
- PL__NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new];
- ALView *previousView = nil;
- for (id object in self) {
- if ([object isKindOfClass:[ALView class]]) {
- ALView *view = (ALView *)object;
- view.translatesAutoresizingMaskIntoConstraints = NO;
- if (previousView) {
- [constraints addObject:[view autoPinEdge:edge toEdge:edge ofView:previousView]];
- }
- previousView = view;
- }
- }
- return constraints;
-}
-
-/**
- Aligns views in this array to one another along a given axis.
- Note: This array must contain at least 2 views, and all views must share a common superview.
-
- @param axis The axis to which the views will be aligned.
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoAlignViewsToAxis:(ALAxis)axis
-{
- NSAssert([self al_containsMinimumNumberOfViews:2], @"This array must contain at least 2 views.");
- PL__NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new];
- ALView *previousView = nil;
- for (id object in self) {
- if ([object isKindOfClass:[ALView class]]) {
- ALView *view = (ALView *)object;
- view.translatesAutoresizingMaskIntoConstraints = NO;
- if (previousView) {
- [constraints addObject:[view autoAlignAxis:axis toSameAxisOfView:previousView]];
- }
- previousView = view;
- }
- }
- return constraints;
-}
-
-/**
- Matches a given dimension of all the views in this array.
- Note: This array must contain at least 2 views, and all views must share a common superview.
-
- @param dimension The dimension to match for all of the views.
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoMatchViewsDimension:(ALDimension)dimension
-{
- NSAssert([self al_containsMinimumNumberOfViews:2], @"This array must contain at least 2 views.");
- PL__NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new];
- ALView *previousView = nil;
- for (id object in self) {
- if ([object isKindOfClass:[ALView class]]) {
- ALView *view = (ALView *)object;
- view.translatesAutoresizingMaskIntoConstraints = NO;
- if (previousView) {
- [constraints addObject:[view autoMatchDimension:dimension toDimension:dimension ofView:previousView]];
- }
- previousView = view;
- }
- }
- return constraints;
-}
-
-/**
- Sets the given dimension of all the views in this array to a given size.
- Note: This array must contain at least 1 view.
-
- @param dimension The dimension of each of the views to set.
- @param size The size to set the given dimension of each view to.
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoSetViewsDimension:(ALDimension)dimension toSize:(CGFloat)size
-{
- NSAssert([self al_containsMinimumNumberOfViews:1], @"This array must contain at least 1 view.");
- PL__NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new];
- for (id object in self) {
- if ([object isKindOfClass:[ALView class]]) {
- ALView *view = (ALView *)object;
- view.translatesAutoresizingMaskIntoConstraints = NO;
- [constraints addObject:[view autoSetDimension:dimension toSize:size]];
- }
- }
- return constraints;
-}
-
-/**
- Sets all of the views in this array to a given size.
- Note: This array must contain at least 1 view.
-
- @param size The size to set each view's dimensions to.
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoSetViewsDimensionsToSize:(CGSize)size
-{
- PL__NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new];
- [constraints addObjectsFromArray:[self autoSetViewsDimension:ALDimensionWidth toSize:size.width]];
- [constraints addObjectsFromArray:[self autoSetViewsDimension:ALDimensionHeight toSize:size.height]];
- return constraints;
-}
-
-
-/**
- Distributes the views in this array equally along the selected axis in their superview.
- Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them,
- including from the first and last views to their superview.
-
- @param axis The axis along which to distribute the views.
- @param alignment The attribute to use to align all the views to one another.
- @param spacing The fixed amount of spacing between each view.
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis
- alignedTo:(ALAttribute)alignment
- withFixedSpacing:(CGFloat)spacing
-{
- return [self autoDistributeViewsAlongAxis:axis
- alignedTo:alignment
- withFixedSpacing:spacing
- insetSpacing:YES];
-}
-
-/**
- Distributes the views in this array equally along the selected axis in their superview.
- Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them.
- The first and last views can optionally be inset from their superview by the same amount of spacing as between views.
-
- @param axis The axis along which to distribute the views.
- @param alignment The attribute to use to align all the views to one another.
- @param spacing The fixed amount of spacing between each view.
- @param shouldSpaceInsets Whether the first and last views should be equally inset from their superview.
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis
- alignedTo:(ALAttribute)alignment
- withFixedSpacing:(CGFloat)spacing
- insetSpacing:(BOOL)shouldSpaceInsets
-{
- return [self autoDistributeViewsAlongAxis:axis
- alignedTo:alignment
- withFixedSpacing:spacing
- insetSpacing:shouldSpaceInsets
- matchedSizes:YES];
-}
-
-/**
- Distributes the views in this array equally along the selected axis in their superview.
- Views will have fixed spacing between them, and can optionally be constrained to the same size in the dimension along the axis.
- The first and last views can optionally be inset from their superview by the same amount of spacing as between views.
-
- @param axis The axis along which to distribute the views.
- @param alignment The attribute to use to align all the views to one another.
- @param spacing The fixed amount of spacing between each view.
- @param shouldSpaceInsets Whether the first and last views should be equally inset from their superview.
- @param shouldMatchSizes Whether all views will be constrained to be the same size in the dimension along the axis.
- NOTE: All views must specify an intrinsic content size if passing NO, otherwise the layout will be ambiguous!
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis
- alignedTo:(ALAttribute)alignment
- withFixedSpacing:(CGFloat)spacing
- insetSpacing:(BOOL)shouldSpaceInsets
- matchedSizes:(BOOL)shouldMatchSizes
-{
- NSAssert([self al_containsMinimumNumberOfViews:1], @"This array must contain at least 1 view to distribute.");
- ALDimension matchedDimension;
- ALEdge firstEdge, lastEdge;
- switch (axis) {
- case ALAxisHorizontal:
- case ALAxisBaseline: // same value as ALAxisLastBaseline
-#if PL__PureLayout_MinBaseSDK_iOS_8_0
- case ALAxisFirstBaseline:
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 */
- matchedDimension = ALDimensionWidth;
- firstEdge = ALEdgeLeading;
- lastEdge = ALEdgeTrailing;
- break;
- case ALAxisVertical:
- matchedDimension = ALDimensionHeight;
- firstEdge = ALEdgeTop;
- lastEdge = ALEdgeBottom;
- break;
- default:
- NSAssert(nil, @"Not a valid ALAxis.");
- return nil;
- }
- CGFloat leadingSpacing = shouldSpaceInsets ? spacing : 0.0;
- CGFloat trailingSpacing = shouldSpaceInsets ? spacing : 0.0;
-
- PL__NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new];
- ALView *previousView = nil;
- for (id object in self) {
- if ([object isKindOfClass:[ALView class]]) {
- ALView *view = (ALView *)object;
- view.translatesAutoresizingMaskIntoConstraints = NO;
- if (previousView) {
- // Second, Third, ... View
- [constraints addObject:[view autoPinEdge:firstEdge toEdge:lastEdge ofView:previousView withOffset:spacing]];
- if (shouldMatchSizes) {
- [constraints addObject:[view autoMatchDimension:matchedDimension toDimension:matchedDimension ofView:previousView]];
- }
- [constraints addObject:[view al_alignAttribute:alignment toView:previousView forAxis:axis]];
- }
- else {
- // First view
- [constraints addObject:[view autoPinEdgeToSuperviewEdge:firstEdge withInset:leadingSpacing]];
- }
- previousView = view;
- }
- }
- if (previousView) {
- // Last View
- [constraints addObject:[previousView autoPinEdgeToSuperviewEdge:lastEdge withInset:trailingSpacing]];
- }
- return constraints;
-}
-
-/**
- Distributes the views in this array equally along the selected axis in their superview.
- Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them,
- including from the first and last views to their superview.
-
- @param axis The axis along which to distribute the views.
- @param alignment The attribute to use to align all the views to one another.
- @param size The fixed size of each view in the dimension along the given axis.
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis
- alignedTo:(ALAttribute)alignment
- withFixedSize:(CGFloat)size
-{
- return [self autoDistributeViewsAlongAxis:axis
- alignedTo:alignment
- withFixedSize:size
- insetSpacing:YES];
-}
-
-/**
- Distributes the views in this array equally along the selected axis in their superview.
- Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them.
- The first and last views can optionally be inset from their superview by the same amount of spacing as between views.
-
- @param axis The axis along which to distribute the views.
- @param alignment The attribute to use to align all the views to one another.
- @param size The fixed size of each view in the dimension along the given axis.
- @param shouldSpaceInsets Whether the first and last views should be equally inset from their superview.
- @return An array of constraints added.
- */
-- (PL__NSArray_of(NSLayoutConstraint *) *)autoDistributeViewsAlongAxis:(ALAxis)axis
- alignedTo:(ALAttribute)alignment
- withFixedSize:(CGFloat)size
- insetSpacing:(BOOL)shouldSpaceInsets
-{
- NSAssert([self al_containsMinimumNumberOfViews:1], @"This array must contain at least 1 view to distribute.");
- ALDimension fixedDimension;
- NSLayoutAttribute attribute;
- switch (axis) {
- case ALAxisHorizontal:
- case ALAxisBaseline: // same value as ALAxisLastBaseline
-#if PL__PureLayout_MinBaseSDK_iOS_8_0
- case ALAxisFirstBaseline:
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 */
- fixedDimension = ALDimensionWidth;
- attribute = NSLayoutAttributeCenterX;
- break;
- case ALAxisVertical:
- fixedDimension = ALDimensionHeight;
- attribute = NSLayoutAttributeCenterY;
- break;
- default:
- NSAssert(nil, @"Not a valid ALAxis.");
- return nil;
- }
-#if TARGET_OS_IPHONE
-# if !defined(PURELAYOUT_APP_EXTENSIONS)
- BOOL isRightToLeftLayout = [[UIApplication sharedApplication] userInterfaceLayoutDirection] == UIUserInterfaceLayoutDirectionRightToLeft;
-# else
- // App Extensions may not access -[UIApplication sharedApplication]; fall back to checking the bundle's preferred localization character direction
- BOOL isRightToLeftLayout = [NSLocale characterDirectionForLanguage:[[NSBundle mainBundle] preferredLocalizations][0]] == NSLocaleLanguageDirectionRightToLeft;
-# endif /* !defined(PURELAYOUT_APP_EXTENSIONS) */
-#else
- BOOL isRightToLeftLayout = [[NSApplication sharedApplication] userInterfaceLayoutDirection] == NSUserInterfaceLayoutDirectionRightToLeft;
-#endif /* TARGET_OS_IPHONE */
- BOOL shouldFlipOrder = isRightToLeftLayout && (axis != ALAxisVertical); // imitate the effect of leading/trailing when distributing horizontally
-
- PL__NSMutableArray_of(NSLayoutConstraint *) *constraints = [NSMutableArray new];
- PL__NSArray_of(ALView *) *views = [self al_copyViewsOnly];
- NSUInteger numberOfViews = [views count];
- ALView *commonSuperview = [views al_commonSuperviewOfViews];
- ALView *previousView = nil;
- for (NSUInteger i = 0; i < numberOfViews; i++) {
- ALView *view = shouldFlipOrder ? views[numberOfViews - i - 1] : views[i];
- view.translatesAutoresizingMaskIntoConstraints = NO;
- [constraints addObject:[view autoSetDimension:fixedDimension toSize:size]];
- CGFloat multiplier, constant;
- if (shouldSpaceInsets) {
- multiplier = (i * 2.0 + 2.0) / (numberOfViews + 1.0);
- constant = (multiplier - 1.0) * size / 2.0;
- } else {
- multiplier = (i * 2.0) / (numberOfViews - 1.0);
- constant = (-multiplier + 1.0) * size / 2.0;
- }
- // If the multiplier is very close to 0, set it to the minimum value to prevent the second item in the constraint from being lost. Filed as rdar://19168380
- if (fabs(multiplier) < kMULTIPLIER_MIN_VALUE) {
- multiplier = kMULTIPLIER_MIN_VALUE;
- }
- NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:view attribute:attribute relatedBy:NSLayoutRelationEqual toItem:commonSuperview attribute:attribute multiplier:multiplier constant:constant];
- [constraint autoInstall];
- [constraints addObject:constraint];
- if (previousView) {
- [constraints addObject:[view al_alignAttribute:alignment toView:previousView forAxis:axis]];
- }
- previousView = view;
- }
- return constraints;
-}
-
-#pragma mark Internal Helper Methods
-
-/**
- Returns the common superview for the views in this array. If there is only one view in the array, its superview will be returned.
- Raises an exception if the views in this array do not share a common superview.
-
- @return The common superview for the views in this array.
- */
-- (ALView *)al_commonSuperviewOfViews
-{
- ALView *commonSuperview = nil;
- ALView *previousView = nil;
- for (id object in self) {
- if ([object isKindOfClass:[ALView class]]) {
- ALView *view = (ALView *)object;
- if (previousView) {
- commonSuperview = [view al_commonSuperviewWithView:commonSuperview];
- } else {
- commonSuperview = view.superview;
- }
- previousView = view;
- }
- }
- NSAssert(commonSuperview, @"Can't constrain views that do not share a common superview. Make sure that all the views in this array have been added into the same view hierarchy.");
- return commonSuperview;
-}
-
-/**
- Determines whether this array contains a minimum number of views.
-
- @param minimumNumberOfViews The minimum number of views to check for.
- @return YES if this array contains at least the minimum number of views, NO otherwise.
- */
-- (BOOL)al_containsMinimumNumberOfViews:(NSUInteger)minimumNumberOfViews
-{
- NSUInteger numberOfViews = 0;
- for (id object in self) {
- if ([object isKindOfClass:[ALView class]]) {
- numberOfViews++;
- if (numberOfViews >= minimumNumberOfViews) {
- return YES;
- }
- }
- }
- return numberOfViews >= minimumNumberOfViews;
-}
-
-/**
- Creates a copy of this array containing only the view objects in it.
-
- @return A new array containing only the views that are in this array.
- */
-- (PL__NSArray_of(ALView *) *)al_copyViewsOnly
-{
- PL__NSMutableArray_of(ALView *) *viewsOnlyArray = [NSMutableArray arrayWithCapacity:[self count]];
- for (id object in self) {
- if ([object isKindOfClass:[ALView class]]) {
- [viewsOnlyArray addObject:object];
- }
- }
- return viewsOnlyArray;
-}
-
-@end
diff --git a/Libraries external/PureLayout/NSLayoutConstraint+PureLayout.h b/Libraries external/PureLayout/NSLayoutConstraint+PureLayout.h
deleted file mode 100755
index ae48ca0fe..000000000
--- a/Libraries external/PureLayout/NSLayoutConstraint+PureLayout.h
+++ /dev/null
@@ -1,84 +0,0 @@
-//
-// NSLayoutConstraint+PureLayout.h
-// https://github.com/PureLayout/PureLayout
-//
-// Copyright (c) 2013-2015 Tyler Fox
-//
-// This code is distributed under the terms and conditions of the MIT license.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//
-
-#import "PureLayoutDefines.h"
-
-
-PL__ASSUME_NONNULL_BEGIN
-
-#pragma mark NSLayoutConstraint+PureLayout
-
-/**
- A category on NSLayoutConstraint that allows constraints to be easily installed & removed.
- */
-@interface NSLayoutConstraint (PureLayout)
-
-
-#pragma mark Batch Constraint Creation
-
-/** Creates all of the constraints in the block, then installs (activates) them all at once.
- All constraints created from calls to the PureLayout API in the block are returned in a single array.
- This may be more efficient than installing (activating) each constraint one-by-one. */
-+ (PL__NSArray_of(NSLayoutConstraint *) *)autoCreateAndInstallConstraints:(__attribute__((noescape)) ALConstraintsBlock)block;
-
-/** Creates all of the constraints in the block but prevents them from being automatically installed (activated).
- All constraints created from calls to the PureLayout API in the block are returned in a single array. */
-+ (PL__NSArray_of(NSLayoutConstraint *) *)autoCreateConstraintsWithoutInstalling:(__attribute__((noescape)) ALConstraintsBlock)block;
-
-
-#pragma mark Set Priority For Constraints
-
-/** Sets the constraint priority to the given value for all constraints created using the PureLayout API within the given constraints block.
- NOTE: This method will have no effect (and will NOT set the priority) on constraints created or added without using the PureLayout API! */
-+ (void)autoSetPriority:(ALLayoutPriority)priority forConstraints:(__attribute__((noescape)) ALConstraintsBlock)block;
-
-
-#pragma mark Identify Constraints
-
-#if PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10
-
-/** Sets the identifier for all constraints created using the PureLayout API within the given constraints block.
- NOTE: This method will have no effect (and will NOT set the identifier) on constraints created or added without using the PureLayout API! */
-+ (void)autoSetIdentifier:(NSString *)identifier forConstraints:(__attribute__((noescape)) ALConstraintsBlock)block;
-
-/** Sets the string as the identifier for this constraint. Available in iOS 7.0 and OS X 10.9 and later. */
-- (instancetype)autoIdentify:(NSString *)identifier;
-
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10 */
-
-
-#pragma mark Install & Remove Constraints
-
-/** Activates the the constraint. */
-- (void)autoInstall;
-
-/** Deactivates the constraint. */
-- (void)autoRemove;
-
-@end
-
-PL__ASSUME_NONNULL_END
diff --git a/Libraries external/PureLayout/NSLayoutConstraint+PureLayout.m b/Libraries external/PureLayout/NSLayoutConstraint+PureLayout.m
deleted file mode 100755
index 5738bc000..000000000
--- a/Libraries external/PureLayout/NSLayoutConstraint+PureLayout.m
+++ /dev/null
@@ -1,552 +0,0 @@
-//
-// NSLayoutConstraint+PureLayout.m
-// https://github.com/PureLayout/PureLayout
-//
-// Copyright (c) 2013-2015 Tyler Fox
-//
-// This code is distributed under the terms and conditions of the MIT license.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//
-
-#import "NSLayoutConstraint+PureLayout.h"
-#import "ALView+PureLayout.h"
-#import "NSArray+PureLayout.h"
-#import "PureLayout+Internal.h"
-
-
-#pragma mark - NSLayoutConstraint+PureLayout
-
-@implementation NSLayoutConstraint (PureLayout)
-
-#pragma mark Batch Constraint Creation
-
-/**
- A global variable that stores a stack of arrays of constraints created without being immediately installed.
- When executing a constraints block passed into the +[autoCreateConstraintsWithoutInstalling:] method, a new
- mutable array is pushed onto this stack, and all constraints created with PureLayout in the block are added
- to this array. When the block finishes executing, the array is popped off this stack. Automatic constraint
- installation is prevented if this stack contains at least 1 array.
-
- NOTE: Access to this variable is not synchronized (and should only be done on the main thread).
- */
-static PL__NSMutableArray_of(PL__NSMutableArray_of(NSLayoutConstraint *) *) *_al_arraysOfCreatedConstraints = nil;
-
-/**
- A global variable that is set to YES when installing a batch of constraints collected from a call to +[autoCreateAndInstallConstraints].
- When this flag is YES, constraints are installed immediately without checking for or adding to the +[al_currentArrayOfCreatedConstraints].
- This is necessary to properly handle nested calls to +[autoCreateAndInstallConstraints], where calls whose block contains other call(s)
- should not return constraints from within the blocks of nested call(s).
- */
-static BOOL _al_isInstallingCreatedConstraints = NO;
-
-/**
- Accessor for the global state that stores arrays of constraints created without being installed.
- */
-+ (PL__NSMutableArray_of(PL__NSMutableArray_of(NSLayoutConstraint *) *) *)al_arraysOfCreatedConstraints
-{
- NSAssert([NSThread isMainThread], @"PureLayout is not thread safe, and must be used exclusively from the main thread.");
- if (!_al_arraysOfCreatedConstraints) {
- _al_arraysOfCreatedConstraints = [NSMutableArray new];
- }
- return _al_arraysOfCreatedConstraints;
-}
-
-/**
- Accessor for the current mutable array of constraints created without being immediately installed.
- */
-+ (PL__NSMutableArray_of(NSLayoutConstraint *) *)al_currentArrayOfCreatedConstraints
-{
- return [[self al_arraysOfCreatedConstraints] lastObject];
-}
-
-/**
- Accessor for the global state that determines whether automatic constraint installation should be prevented.
- */
-+ (BOOL)al_preventAutomaticConstraintInstallation
-{
- return (_al_isInstallingCreatedConstraints == NO) && ([[self al_arraysOfCreatedConstraints] count] > 0);
-}
-
-/**
- Creates all of the constraints in the block, then installs (activates) them all at once.
- All constraints created from calls to the PureLayout API in the block are returned in a single array.
- This may be more efficient than installing (activating) each constraint one-by-one.
-
- Note: calls to this method may be nested. The constraints returned from a call will NOT include constraints
- created in nested calls; constraints are only returned from the inner-most call they are created within.
-
- @param block A block of method calls to the PureLayout API that create constraints.
- @return An array of the constraints that were created from calls to the PureLayout API inside the block.
- */
-+ (PL__NSArray_of(NSLayoutConstraint *) *)autoCreateAndInstallConstraints:(__attribute__((noescape)) ALConstraintsBlock)block
-{
- NSArray *createdConstraints = [self autoCreateConstraintsWithoutInstalling:block];
- _al_isInstallingCreatedConstraints = YES;
- [createdConstraints autoInstallConstraints];
- _al_isInstallingCreatedConstraints = NO;
- return createdConstraints;
-}
-
-/**
- Creates all of the constraints in the block but prevents them from being automatically installed (activated).
- All constraints created from calls to the PureLayout API in the block are returned in a single array.
-
- Note: calls to this method may be nested. The constraints returned from a call will NOT include constraints
- created in nested calls; constraints are only returned from the inner-most call they are created within.
-
- @param block A block of method calls to the PureLayout API that create constraints.
- @return An array of the constraints that were created from calls to the PureLayout API inside the block.
- */
-+ (PL__NSArray_of(NSLayoutConstraint *) *)autoCreateConstraintsWithoutInstalling:(__attribute__((noescape)) ALConstraintsBlock)block
-{
- NSAssert(block, @"The constraints block cannot be nil.");
- NSArray *createdConstraints = nil;
- if (block) {
- [[self al_arraysOfCreatedConstraints] addObject:[NSMutableArray new]];
- block();
- createdConstraints = [self al_currentArrayOfCreatedConstraints];
- [[self al_arraysOfCreatedConstraints] removeLastObject];
- }
- return createdConstraints;
-}
-
-
-#pragma mark Set Priority For Constraints
-
-/**
- A global variable that stores a stack of layout priorities to set on constraints.
- When executing a constraints block passed into the +[autoSetPriority:forConstraints:] method, the priority for
- that call is pushed onto this stack, and when the block finishes executing, that priority is popped off this
- stack. If this stack contains at least 1 priority, the priority at the top of the stack will be set for all
- constraints created by this library (even if automatic constraint installation is being prevented).
- NOTE: Access to this variable is not synchronized (and should only be done on the main thread).
- */
-static PL__NSMutableArray_of(NSNumber *) *_al_globalConstraintPriorities = nil;
-
-/**
- Accessor for the global stack of layout priorities.
- */
-+ (PL__NSMutableArray_of(NSNumber *) *)al_globalConstraintPriorities
-{
- NSAssert([NSThread isMainThread], @"PureLayout is not thread safe, and must be used exclusively from the main thread.");
- if (!_al_globalConstraintPriorities) {
- _al_globalConstraintPriorities = [NSMutableArray new];
- }
- return _al_globalConstraintPriorities;
-}
-
-/**
- Returns the current layout priority to use for constraints.
- When executing a constraints block passed into +[autoSetPriority:forConstraints:], this will return
- the priority for the current block. Otherwise, the default Required priority is returned.
- */
-+ (ALLayoutPriority)al_currentGlobalConstraintPriority
-{
- PL__NSMutableArray_of(NSNumber *) *globalConstraintPriorities = [self al_globalConstraintPriorities];
- if ([globalConstraintPriorities count] == 0) {
- return ALLayoutPriorityRequired;
- }
- return [[globalConstraintPriorities lastObject] floatValue];
-}
-
-/**
- Accessor for the global state that determines if we're currently in the scope of a priority constraints block.
- */
-+ (BOOL)al_isExecutingPriorityConstraintsBlock
-{
- return [[self al_globalConstraintPriorities] count] > 0;
-}
-
-/**
- Sets the constraint priority to the given value for all constraints created using the PureLayout
- API within the given constraints block.
-
- NOTE: This method will have no effect (and will NOT set the priority) on constraints created or added
- without using the PureLayout API!
-
- @param priority The layout priority to be set on all constraints created in the constraints block.
- @param block A block of method calls to the PureLayout API that create and install constraints.
- */
-+ (void)autoSetPriority:(ALLayoutPriority)priority forConstraints:(__attribute__((noescape)) ALConstraintsBlock)block
-{
- NSAssert(block, @"The constraints block cannot be nil.");
- if (block) {
- [[self al_globalConstraintPriorities] addObject:@(priority)];
- block();
- [[self al_globalConstraintPriorities] removeLastObject];
- }
-}
-
-
-#pragma mark Identify Constraints
-
-#if PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10
-
-/**
- A global variable that stores a stack of identifier strings to set on constraints.
- When executing a constraints block passed into the +[autoSetIdentifier:forConstraints:] method, the identifier for
- that call is pushed onto this stack, and when the block finishes executing, that identifier is popped off this
- stack. If this stack contains at least 1 identifier, the identifier at the top of the stack will be set for all
- constraints created by this library (even if automatic constraint installation is being prevented).
- NOTE: Access to this variable is not synchronized (and should only be done on the main thread).
- */
-static PL__NSMutableArray_of(NSString *) *_al_globalConstraintIdentifiers = nil;
-
-/**
- Accessor for the global state of constraint identifiers.
- */
-+ (PL__NSMutableArray_of(NSString *) *)al_globalConstraintIdentifiers
-{
- NSAssert([NSThread isMainThread], @"PureLayout is not thread safe, and must be used exclusively from the main thread.");
- if (!_al_globalConstraintIdentifiers) {
- _al_globalConstraintIdentifiers = [NSMutableArray new];
- }
- return _al_globalConstraintIdentifiers;
-}
-
-/**
- Returns the current identifier string to use for constraints.
- When executing a constraints block passed into +[autoSetIdentifier:forConstraints:], this will return
- the identifier for the current block. Otherwise, nil is returned.
- */
-+ (NSString *)al_currentGlobalConstraintIdentifier
-{
- PL__NSMutableArray_of(NSString *) *globalConstraintIdentifiers = [self al_globalConstraintIdentifiers];
- if ([globalConstraintIdentifiers count] == 0) {
- return nil;
- }
- return [globalConstraintIdentifiers lastObject];
-}
-
-/**
- Sets the identifier for all constraints created using the PureLayout API within the given constraints block.
-
- NOTE: This method will have no effect (and will NOT set the identifier) on constraints created or added
- without using the PureLayout API!
-
- @param identifier A string used to identify all constraints created in the constraints block.
- @param block A block of method calls to the PureLayout API that create and install constraints.
- */
-+ (void)autoSetIdentifier:(NSString *)identifier forConstraints:(__attribute__((noescape)) ALConstraintsBlock)block
-{
- NSAssert(block, @"The constraints block cannot be nil.");
- NSAssert(identifier, @"The identifier string cannot be nil.");
- if (block) {
- if (identifier) {
- [[self al_globalConstraintIdentifiers] addObject:identifier];
- }
- block();
- if (identifier) {
- [[self al_globalConstraintIdentifiers] removeLastObject];
- }
- }
-}
-
-/**
- Sets the string as the identifier for this constraint. Available in iOS 7.0 and OS X 10.9 and later.
- The identifier will be printed along with the constraint's description.
- This is helpful to document a constraint's purpose and aid in debugging.
-
- @param identifier A string used to identify this constraint.
- @return This constraint.
- */
-- (instancetype)autoIdentify:(NSString *)identifier
-{
- if ([self respondsToSelector:@selector(setIdentifier:)]) {
- self.identifier = identifier;
- }
- return self;
-}
-
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10 */
-
-
-#pragma mark Install & Remove Constraints
-
-/**
- Activates the constraint.
- */
-- (void)autoInstall
-{
-#if PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10
- if ([self respondsToSelector:@selector(setActive:)]) {
- [NSLayoutConstraint al_applyGlobalStateToConstraint:self];
- if ([NSLayoutConstraint al_preventAutomaticConstraintInstallation]) {
- [[NSLayoutConstraint al_currentArrayOfCreatedConstraints] addObject:self];
- } else {
- self.active = YES;
- }
- return;
- }
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10 */
-
- NSAssert(self.firstItem || self.secondItem, @"Can't install a constraint with nil firstItem and secondItem.");
- if (self.firstItem) {
- if (self.secondItem) {
- NSAssert([self.firstItem isKindOfClass:[ALView class]] && [self.secondItem isKindOfClass:[ALView class]], @"Can only automatically install a constraint if both items are views.");
- ALView *commonSuperview = [self.firstItem al_commonSuperviewWithView:self.secondItem];
- [commonSuperview al_addConstraint:self];
- } else {
- NSAssert([self.firstItem isKindOfClass:[ALView class]], @"Can only automatically install a constraint if the item is a view.");
- [self.firstItem al_addConstraint:self];
- }
- } else {
- NSAssert([self.secondItem isKindOfClass:[ALView class]], @"Can only automatically install a constraint if the item is a view.");
- [self.secondItem al_addConstraint:self];
- }
-}
-
-/**
- Deactivates the constraint.
- */
-- (void)autoRemove
-{
-#if PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10
- if ([self respondsToSelector:@selector(setActive:)]) {
- self.active = NO;
- return;
- }
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10 */
-
- if (self.secondItem) {
- ALView *commonSuperview = [self.firstItem al_commonSuperviewWithView:self.secondItem];
- while (commonSuperview) {
- if ([commonSuperview.constraints containsObject:self]) {
- [commonSuperview removeConstraint:self];
- return;
- }
- commonSuperview = commonSuperview.superview;
- }
- }
- else {
- [self.firstItem removeConstraint:self];
- return;
- }
- NSAssert(nil, @"Failed to remove constraint: %@", self);
-}
-
-
-#pragma mark Internal Methods
-
-/**
- Applies the global constraint priority and identifier to the given constraint.
- This should be done before installing all constraints.
-
- @param constraint The constraint to set the global priority and identifier on.
- */
-+ (void)al_applyGlobalStateToConstraint:(NSLayoutConstraint *)constraint
-{
- if ([NSLayoutConstraint al_isExecutingPriorityConstraintsBlock]) {
- constraint.priority = [NSLayoutConstraint al_currentGlobalConstraintPriority];
- }
-#if PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10
- NSString *globalConstraintIdentifier = [NSLayoutConstraint al_currentGlobalConstraintIdentifier];
- if (globalConstraintIdentifier) {
- [constraint autoIdentify:globalConstraintIdentifier];
- }
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10 */
-}
-
-/**
- Returns the corresponding NSLayoutAttribute for the given ALAttribute.
-
- @return The layout attribute for the given ALAttribute.
- */
-+ (NSLayoutAttribute)al_layoutAttributeForAttribute:(ALAttribute)attribute
-{
- NSLayoutAttribute layoutAttribute = NSLayoutAttributeNotAnAttribute;
- switch (attribute) {
- case ALEdgeLeft:
- layoutAttribute = NSLayoutAttributeLeft;
- break;
- case ALEdgeRight:
- layoutAttribute = NSLayoutAttributeRight;
- break;
- case ALEdgeTop:
- layoutAttribute = NSLayoutAttributeTop;
- break;
- case ALEdgeBottom:
- layoutAttribute = NSLayoutAttributeBottom;
- break;
- case ALEdgeLeading:
- layoutAttribute = NSLayoutAttributeLeading;
- break;
- case ALEdgeTrailing:
- layoutAttribute = NSLayoutAttributeTrailing;
- break;
- case ALDimensionWidth:
- layoutAttribute = NSLayoutAttributeWidth;
- break;
- case ALDimensionHeight:
- layoutAttribute = NSLayoutAttributeHeight;
- break;
- case ALAxisVertical:
- layoutAttribute = NSLayoutAttributeCenterX;
- break;
- case ALAxisHorizontal:
- layoutAttribute = NSLayoutAttributeCenterY;
- break;
- case ALAxisBaseline: // same value as ALAxisLastBaseline
- layoutAttribute = NSLayoutAttributeBaseline;
- break;
-#if PL__PureLayout_MinBaseSDK_iOS_8_0
- case ALAxisFirstBaseline:
- NSAssert(PL__PureLayout_MinSysVer_iOS_8_0, @"ALAxisFirstBaseline is only supported on iOS 8.0 or higher.");
- layoutAttribute = NSLayoutAttributeFirstBaseline;
- break;
- case ALMarginLeft:
- NSAssert(PL__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeLeftMargin is only supported on iOS 8.0 or higher.");
- layoutAttribute = NSLayoutAttributeLeftMargin;
- break;
- case ALMarginRight:
- NSAssert(PL__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeRightMargin is only supported on iOS 8.0 or higher.");
- layoutAttribute = NSLayoutAttributeRightMargin;
- break;
- case ALMarginTop:
- NSAssert(PL__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeTopMargin is only supported on iOS 8.0 or higher.");
- layoutAttribute = NSLayoutAttributeTopMargin;
- break;
- case ALMarginBottom:
- NSAssert(PL__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeBottomMargin is only supported on iOS 8.0 or higher.");
- layoutAttribute = NSLayoutAttributeBottomMargin;
- break;
- case ALMarginLeading:
- NSAssert(PL__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeLeadingMargin is only supported on iOS 8.0 or higher.");
- layoutAttribute = NSLayoutAttributeLeadingMargin;
- break;
- case ALMarginTrailing:
- NSAssert(PL__PureLayout_MinSysVer_iOS_8_0, @"ALEdgeTrailingMargin is only supported on iOS 8.0 or higher.");
- layoutAttribute = NSLayoutAttributeTrailingMargin;
- break;
- case ALMarginAxisVertical:
- NSAssert(PL__PureLayout_MinSysVer_iOS_8_0, @"ALAxisVerticalMargin is only supported on iOS 8.0 or higher.");
- layoutAttribute = NSLayoutAttributeCenterXWithinMargins;
- break;
- case ALMarginAxisHorizontal:
- NSAssert(PL__PureLayout_MinSysVer_iOS_8_0, @"ALAxisHorizontalMargin is only supported on iOS 8.0 or higher.");
- layoutAttribute = NSLayoutAttributeCenterYWithinMargins;
- break;
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 */
- default:
- NSAssert(nil, @"Not a valid ALAttribute.");
- break;
- }
- return layoutAttribute;
-}
-
-/**
- Returns the corresponding ALLayoutConstraintAxis for the given ALAxis.
-
- @return The constraint axis for the given axis.
- */
-+ (ALLayoutConstraintAxis)al_constraintAxisForAxis:(ALAxis)axis
-{
- ALLayoutConstraintAxis constraintAxis;
- switch (axis) {
- case ALAxisVertical:
- constraintAxis = ALLayoutConstraintAxisVertical;
- break;
- case ALAxisHorizontal:
- case ALAxisBaseline: // same value as ALAxisLastBaseline
-#if PL__PureLayout_MinBaseSDK_iOS_8_0
- case ALAxisFirstBaseline:
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 */
- constraintAxis = ALLayoutConstraintAxisHorizontal;
- break;
- default:
- NSAssert(nil, @"Not a valid ALAxis.");
- constraintAxis = ALLayoutConstraintAxisHorizontal; // default to an arbitrary value to satisfy the compiler
- break;
- }
- return constraintAxis;
-}
-
-#if PL__PureLayout_MinBaseSDK_iOS_8_0
-
-/**
- Returns the corresponding margin for the given edge.
-
- @param edge The edge to convert to the corresponding margin.
- @return The margin for the given edge.
- */
-+ (ALMargin)al_marginForEdge:(ALEdge)edge
-{
- NSAssert(PL__PureLayout_MinSysVer_iOS_8_0, @"Margin attributes are only supported on iOS 8.0 or higher.");
- ALMargin margin;
- switch (edge) {
- case ALEdgeLeft:
- margin = ALMarginLeft;
- break;
- case ALEdgeRight:
- margin = ALMarginRight;
- break;
- case ALEdgeTop:
- margin = ALMarginTop;
- break;
- case ALEdgeBottom:
- margin = ALMarginBottom;
- break;
- case ALEdgeLeading:
- margin = ALMarginLeading;
- break;
- case ALEdgeTrailing:
- margin = ALMarginTrailing;
- break;
- default:
- NSAssert(nil, @"Not a valid ALEdge.");
- margin = ALMarginLeft; // default to an arbitrary value to satisfy the compiler
- break;
- }
- return margin;
-}
-
-/**
- Returns the corresponding margin axis for the given axis.
-
- @param axis The axis to convert to the corresponding margin axis.
- @return The margin axis for the given axis.
- */
-+ (ALMarginAxis)al_marginAxisForAxis:(ALAxis)axis
-{
- NSAssert(PL__PureLayout_MinSysVer_iOS_8_0, @"Margin attributes are only supported on iOS 8.0 or higher.");
- ALMarginAxis marginAxis;
- switch (axis) {
- case ALAxisVertical:
- marginAxis = ALMarginAxisVertical;
- break;
- case ALAxisHorizontal:
- marginAxis = ALMarginAxisHorizontal;
- break;
- case ALAxisBaseline:
- case ALAxisFirstBaseline:
- NSAssert(nil, @"The baseline axis attributes do not have corresponding margin axis attributes.");
- marginAxis = ALMarginAxisVertical; // default to an arbitrary value to satisfy the compiler
- break;
- default:
- NSAssert(nil, @"Not a valid ALAxis.");
- marginAxis = ALMarginAxisVertical; // default to an arbitrary value to satisfy the compiler
- break;
- }
- return marginAxis;
-}
-
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 */
-
-@end
diff --git a/Libraries external/PureLayout/PureLayout+Internal.h b/Libraries external/PureLayout/PureLayout+Internal.h
deleted file mode 100755
index 15c2eeb71..000000000
--- a/Libraries external/PureLayout/PureLayout+Internal.h
+++ /dev/null
@@ -1,87 +0,0 @@
-//
-// PureLayout+Internal.h
-// https://github.com/PureLayout/PureLayout
-//
-// Copyright (c) 2014-2015 Tyler Fox
-//
-// This code is distributed under the terms and conditions of the MIT license.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//
-
-#import "PureLayoutDefines.h"
-
-
-// Using generics with NSMutableArray is so common in the internal implementation of PureLayout that it gets a dedicated preprocessor macro for better readability.
-#define PL__NSMutableArray_of(type) PL__GENERICS(NSMutableArray, type)
-
-PL__ASSUME_NONNULL_BEGIN
-
-/** A constant that represents the smallest valid positive value for the multiplier of a constraint,
- since a value of 0 will cause the second item to be lost in the internal auto layout engine. */
-static const CGFloat kMULTIPLIER_MIN_VALUE = (CGFloat)0.00001; // very small floating point numbers (e.g. CGFLOAT_MIN) can cause problems
-
-
-/**
- A category that exposes the internal (private) helper methods of the ALView+PureLayout category.
- */
-@interface ALView (PureLayoutInternal)
-
-- (void)al_addConstraint:(NSLayoutConstraint *)constraint;
-- (ALView *)al_commonSuperviewWithView:(ALView *)otherView;
-- (NSLayoutConstraint *)al_alignAttribute:(ALAttribute)attribute toView:(ALView *)otherView forAxis:(ALAxis)axis;
-
-@end
-
-
-/**
- A category that exposes the internal (private) helper methods of the NSArray+PureLayout category.
- */
-@interface NSArray (PureLayoutInternal)
-
-- (ALView *)al_commonSuperviewOfViews;
-- (BOOL)al_containsMinimumNumberOfViews:(NSUInteger)minimumNumberOfViews;
-- (PL__NSArray_of(ALView *) *)al_copyViewsOnly;
-
-@end
-
-
-/**
- A category that exposes the internal (private) helper methods of the NSLayoutConstraint+PureLayout category.
- */
-@interface NSLayoutConstraint (PureLayoutInternal)
-
-+ (BOOL)al_preventAutomaticConstraintInstallation;
-+ (PL__NSMutableArray_of(NSLayoutConstraint *) *)al_currentArrayOfCreatedConstraints;
-+ (BOOL)al_isExecutingPriorityConstraintsBlock;
-+ (ALLayoutPriority)al_currentGlobalConstraintPriority;
-#if PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10
-+ (nullable NSString *)al_currentGlobalConstraintIdentifier;
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 || PL__PureLayout_MinBaseSDK_OSX_10_10 */
-+ (void)al_applyGlobalStateToConstraint:(NSLayoutConstraint *)constraint;
-+ (NSLayoutAttribute)al_layoutAttributeForAttribute:(ALAttribute)attribute;
-+ (ALLayoutConstraintAxis)al_constraintAxisForAxis:(ALAxis)axis;
-#if PL__PureLayout_MinBaseSDK_iOS_8_0
-+ (ALMargin)al_marginForEdge:(ALEdge)edge;
-+ (ALMarginAxis)al_marginAxisForAxis:(ALAxis)axis;
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 */
-
-@end
-
-PL__ASSUME_NONNULL_END
diff --git a/Libraries external/PureLayout/PureLayout.h b/Libraries external/PureLayout/PureLayout.h
deleted file mode 100755
index ab615d32e..000000000
--- a/Libraries external/PureLayout/PureLayout.h
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// PureLayout.h
-// https://github.com/PureLayout/PureLayout
-//
-// Copyright (c) 2014-2015 Tyler Fox
-//
-// This code is distributed under the terms and conditions of the MIT license.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//
-
-#ifndef PureLayout_h
-#define PureLayout_h
-
-#import <Foundation/Foundation.h>
-
-//! Project version number for PureLayout.
-FOUNDATION_EXPORT double PureLayoutVersionNumber;
-
-//! Project version string for PureLayout.
-FOUNDATION_EXPORT const unsigned char PureLayoutVersionString[];
-
-#import "ALView+PureLayout.h"
-#import "NSArray+PureLayout.h"
-#import "NSLayoutConstraint+PureLayout.h"
-
-#endif /* PureLayout_h */
diff --git a/Libraries external/PureLayout/PureLayoutDefines.h b/Libraries external/PureLayout/PureLayoutDefines.h
deleted file mode 100755
index 2e88aceea..000000000
--- a/Libraries external/PureLayout/PureLayoutDefines.h
+++ /dev/null
@@ -1,224 +0,0 @@
-//
-// PureLayoutDefines.h
-// https://github.com/PureLayout/PureLayout
-//
-// Copyright (c) 2014-2015 Tyler Fox
-//
-// This code is distributed under the terms and conditions of the MIT license.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//
-
-#ifndef PureLayoutDefines_h
-#define PureLayoutDefines_h
-
-#import <Foundation/Foundation.h>
-
-// Define some preprocessor macros to check for a minimum Base SDK. These are used to prevent compile-time errors in older versions of Xcode.
-#define PL__PureLayout_MinBaseSDK_iOS_8_0 (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_7_1)
-#define PL__PureLayout_MinBaseSDK_OSX_10_10 (!TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MAX_ALLOWED > __MAC_10_9)
-
-// Define some preprocessor macros to check for a minimum System Version. These are used to prevent runtime crashes on older versions of iOS/OS X.
-#define PL__PureLayout_MinSysVer_iOS_7_0 (TARGET_OS_IPHONE && floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1)
-#define PL__PureLayout_MinSysVer_iOS_8_0 (TARGET_OS_IPHONE && floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_7_1)
-#define PL__PureLayout_MinSysVer_OSX_10_9 (!TARGET_OS_IPHONE && floor(NSFoundationVersionNumber) > NSFoundationVersionNumber10_8_4)
-
-// Define some preprocessor macros that allow nullability annotations to be adopted in a backwards-compatible manner.
-#if __has_feature(nullability)
-# define PL__ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
-# define PL__ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
-#else
-# define PL__ASSUME_NONNULL_BEGIN
-# define PL__ASSUME_NONNULL_END
-#endif
-
-// Define some preprocessor macros that allow generics to be adopted in a backwards-compatible manner.
-#if __has_feature(objc_generics)
-# define PL__GENERICS(class, ...) class<__VA_ARGS__>
-#else
-# define PL__GENERICS(class, ...) class
-#endif
-
-// Using generics with NSArray is so common in PureLayout that it gets a dedicated preprocessor macro for better readability.
-#define PL__NSArray_of(type) PL__GENERICS(NSArray, type)
-
-// Define generic AL-prefixed macros for the types/constants/etc that have slight naming variations across iOS and OS X, which allows the same code to be platform-independent.
-#if TARGET_OS_IPHONE || TARGET_OS_TV
-# import <UIKit/UIKit.h>
-# define ALView UIView
-# define ALEdgeInsets UIEdgeInsets
-# define ALEdgeInsetsZero UIEdgeInsetsZero
-# define ALEdgeInsetsMake UIEdgeInsetsMake
-# define ALLayoutConstraintAxis UILayoutConstraintAxis
-# define ALLayoutConstraintOrientation ALLayoutConstraintAxis
-# define ALLayoutConstraintAxisHorizontal UILayoutConstraintAxisHorizontal
-# define ALLayoutConstraintAxisVertical UILayoutConstraintAxisVertical
-# define ALLayoutConstraintOrientationHorizontal ALLayoutConstraintAxisHorizontal
-# define ALLayoutConstraintOrientationVertical ALLayoutConstraintAxisVertical
-# define ALLayoutPriority UILayoutPriority
-# define ALLayoutPriorityRequired UILayoutPriorityRequired
-# define ALLayoutPriorityDefaultHigh UILayoutPriorityDefaultHigh
-# define ALLayoutPriorityDefaultLow UILayoutPriorityDefaultLow
-# define ALLayoutPriorityFittingSizeLevel UILayoutPriorityFittingSizeLevel
-# define ALLayoutPriorityFittingSizeCompression ALLayoutPriorityFittingSizeLevel
-#else
-# import <Cocoa/Cocoa.h>
-# define ALView NSView
-# define ALEdgeInsets NSEdgeInsets
-# define ALEdgeInsetsZero NSEdgeInsetsMake(0, 0, 0, 0)
-# define ALEdgeInsetsMake NSEdgeInsetsMake
-# define ALLayoutConstraintOrientation NSLayoutConstraintOrientation
-# define ALLayoutConstraintAxis ALLayoutConstraintOrientation
-# define ALLayoutConstraintOrientationHorizontal NSLayoutConstraintOrientationHorizontal
-# define ALLayoutConstraintOrientationVertical NSLayoutConstraintOrientationVertical
-# define ALLayoutConstraintAxisHorizontal ALLayoutConstraintOrientationHorizontal
-# define ALLayoutConstraintAxisVertical ALLayoutConstraintOrientationVertical
-# define ALLayoutPriority NSLayoutPriority
-# define ALLayoutPriorityRequired NSLayoutPriorityRequired
-# define ALLayoutPriorityDefaultHigh NSLayoutPriorityDefaultHigh
-# define ALLayoutPriorityDefaultLow NSLayoutPriorityDefaultLow
-# define ALLayoutPriorityFittingSizeCompression NSLayoutPriorityFittingSizeCompression
-# define ALLayoutPriorityFittingSizeLevel ALLayoutPriorityFittingSizeCompression
-#endif /* TARGET_OS_IPHONE */
-
-
-#pragma mark PureLayout Attributes
-
-/** Constants that represent edges of a view. */
-typedef NS_ENUM(NSInteger, ALEdge) {
- /** The left edge of the view. */
- ALEdgeLeft = NSLayoutAttributeLeft,
- /** The right edge of the view. */
- ALEdgeRight = NSLayoutAttributeRight,
- /** The top edge of the view. */
- ALEdgeTop = NSLayoutAttributeTop,
- /** The bottom edge of the view. */
- ALEdgeBottom = NSLayoutAttributeBottom,
- /** The leading edge of the view (left edge for left-to-right languages like English, right edge for right-to-left languages like Arabic). */
- ALEdgeLeading = NSLayoutAttributeLeading,
- /** The trailing edge of the view (right edge for left-to-right languages like English, left edge for right-to-left languages like Arabic). */
- ALEdgeTrailing = NSLayoutAttributeTrailing
-};
-
-/** Constants that represent dimensions of a view. */
-typedef NS_ENUM(NSInteger, ALDimension) {
- /** The width of the view. */
- ALDimensionWidth = NSLayoutAttributeWidth,
- /** The height of the view. */
- ALDimensionHeight = NSLayoutAttributeHeight
-};
-
-/** Constants that represent axes of a view. */
-typedef NS_ENUM(NSInteger, ALAxis) {
- /** A vertical line equidistant from the view's left and right edges. */
- ALAxisVertical = NSLayoutAttributeCenterX,
- /** A horizontal line equidistant from the view's top and bottom edges. */
- ALAxisHorizontal = NSLayoutAttributeCenterY,
-
- /** A horizontal line at the baseline of the last line of text in the view. (For views that do not draw text, will be equivalent to ALEdgeBottom.) Same as ALAxisLastBaseline. */
- ALAxisBaseline = NSLayoutAttributeBaseline,
- /** A horizontal line at the baseline of the last line of text in the view. (For views that do not draw text, will be equivalent to ALEdgeBottom.) */
- ALAxisLastBaseline = ALAxisBaseline,
- #if PL__PureLayout_MinBaseSDK_iOS_8_0
- /** A horizontal line at the baseline of the first line of text in a view. (For views that do not draw text, will be equivalent to ALEdgeTop.) Available in iOS 8.0 and later. */
- ALAxisFirstBaseline = NSLayoutAttributeFirstBaseline
- #endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 */
-};
-
-#if PL__PureLayout_MinBaseSDK_iOS_8_0
-
-/** Constants that represent layout margins of a view. Available in iOS 8.0 and later. */
-typedef NS_ENUM(NSInteger, ALMargin) {
- /** The left margin of the view, based on the view's layoutMargins left inset. */
- ALMarginLeft = NSLayoutAttributeLeftMargin,
- /** The right margin of the view, based on the view's layoutMargins right inset. */
- ALMarginRight = NSLayoutAttributeRightMargin,
- /** The top margin of the view, based on the view's layoutMargins top inset. */
- ALMarginTop = NSLayoutAttributeTopMargin,
- /** The bottom margin of the view, based on the view's layoutMargins bottom inset. */
- ALMarginBottom = NSLayoutAttributeBottomMargin,
- /** The leading margin of the view, based on the view's layoutMargins left/right (depending on language direction) inset. */
- ALMarginLeading = NSLayoutAttributeLeadingMargin,
- /** The trailing margin of the view, based on the view's layoutMargins left/right (depending on language direction) inset. */
- ALMarginTrailing = NSLayoutAttributeTrailingMargin
-};
-
-/** Constants that represent axes of the layout margins of a view. Available in iOS 8.0 and later. */
-typedef NS_ENUM(NSInteger, ALMarginAxis) {
- /** A vertical line equidistant from the view's left and right margins. */
- ALMarginAxisVertical = NSLayoutAttributeCenterXWithinMargins,
- /** A horizontal line equidistant from the view's top and bottom margins. */
- ALMarginAxisHorizontal = NSLayoutAttributeCenterYWithinMargins
-};
-
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 */
-
-/** An attribute of a view that can be used in auto layout constraints. These constants are identical to the more specific enum types:
- ALEdge, ALAxis, ALDimension, ALMargin, ALMarginAxis. It is safe to cast a more specific enum type to the ALAttribute type. */
-typedef NS_ENUM(NSInteger, ALAttribute) {
- /** The left edge of the view. */
- ALAttributeLeft = ALEdgeLeft,
- /** The right edge of the view. */
- ALAttributeRight = ALEdgeRight,
- /** The top edge of the view. */
- ALAttributeTop = ALEdgeTop,
- /** The bottom edge of the view. */
- ALAttributeBottom = ALEdgeBottom,
- /** The leading edge of the view (left edge for left-to-right languages like English, right edge for right-to-left languages like Arabic). */
- ALAttributeLeading = ALEdgeLeading,
- /** The trailing edge of the view (right edge for left-to-right languages like English, left edge for right-to-left languages like Arabic). */
- ALAttributeTrailing = ALEdgeTrailing,
- /** The width of the view. */
- ALAttributeWidth = ALDimensionWidth,
- /** The height of the view. */
- ALAttributeHeight = ALDimensionHeight,
- /** A vertical line equidistant from the view's left and right edges. */
- ALAttributeVertical = ALAxisVertical,
- /** A horizontal line equidistant from the view's top and bottom edges. */
- ALAttributeHorizontal = ALAxisHorizontal,
- /** A horizontal line at the baseline of the last line of text in the view. (For views that do not draw text, will be equivalent to ALEdgeBottom.) Same as ALAxisLastBaseline. */
- ALAttributeBaseline = ALAxisBaseline,
- /** A horizontal line at the baseline of the last line of text in the view. (For views that do not draw text, will be equivalent to ALEdgeBottom.) */
- ALAttributeLastBaseline = ALAxisLastBaseline,
-#if PL__PureLayout_MinBaseSDK_iOS_8_0
- /** A horizontal line at the baseline of the first line of text in a view. (For views that do not draw text, will be equivalent to ALEdgeTop.) Available in iOS 8.0 and later. */
- ALAttributeFirstBaseline = ALAxisFirstBaseline,
- /** The left margin of the view, based on the view's layoutMargins left inset. */
- ALAttributeMarginLeft = ALMarginLeft,
- /** The right margin of the view, based on the view's layoutMargins right inset. */
- ALAttributeMarginRight = ALMarginRight,
- /** The top margin of the view, based on the view's layoutMargins top inset. */
- ALAttributeMarginTop = ALMarginTop,
- /** The bottom margin of the view, based on the view's layoutMargins bottom inset. */
- ALAttributeMarginBottom = ALMarginBottom,
- /** The leading margin of the view, based on the view's layoutMargins left/right (depending on language direction) inset. */
- ALAttributeMarginLeading = ALMarginLeading,
- /** The trailing margin of the view, based on the view's layoutMargins left/right (depending on language direction) inset. */
- ALAttributeMarginTrailing = ALMarginTrailing,
- /** A vertical line equidistant from the view's left and right margins. */
- ALAttributeMarginAxisVertical = ALMarginAxisVertical,
- /** A horizontal line equidistant from the view's top and bottom margins. */
- ALAttributeMarginAxisHorizontal = ALMarginAxisHorizontal
-#endif /* PL__PureLayout_MinBaseSDK_iOS_8_0 */
-};
-
-/** A block containing method calls to the PureLayout API. Takes no arguments and has no return value. */
-typedef void(^ALConstraintsBlock)(void);
-
-#endif /* PureLayoutDefines_h */