123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- #ifndef PureLayoutDefines_h
- #define PureLayoutDefines_h
- #import <Foundation/Foundation.h>
- #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 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)
- #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
- #if __has_feature(objc_generics)
- # define PL__GENERICS(class, ...) class<__VA_ARGS__>
- #else
- # define PL__GENERICS(class, ...) class
- #endif
- #define PL__NSArray_of(type) PL__GENERICS(NSArray, type)
- #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
- #pragma mark PureLayout Attributes
- typedef NS_ENUM(NSInteger, ALEdge) {
-
- ALEdgeLeft = NSLayoutAttributeLeft,
-
- ALEdgeRight = NSLayoutAttributeRight,
-
- ALEdgeTop = NSLayoutAttributeTop,
-
- ALEdgeBottom = NSLayoutAttributeBottom,
-
- ALEdgeLeading = NSLayoutAttributeLeading,
-
- ALEdgeTrailing = NSLayoutAttributeTrailing
- };
- typedef NS_ENUM(NSInteger, ALDimension) {
-
- ALDimensionWidth = NSLayoutAttributeWidth,
-
- ALDimensionHeight = NSLayoutAttributeHeight
- };
- typedef NS_ENUM(NSInteger, ALAxis) {
-
- ALAxisVertical = NSLayoutAttributeCenterX,
-
- ALAxisHorizontal = NSLayoutAttributeCenterY,
-
-
- ALAxisBaseline = NSLayoutAttributeBaseline,
-
- ALAxisLastBaseline = ALAxisBaseline,
- #if PL__PureLayout_MinBaseSDK_iOS_8_0
-
- ALAxisFirstBaseline = NSLayoutAttributeFirstBaseline
- #endif
- };
- #if PL__PureLayout_MinBaseSDK_iOS_8_0
- typedef NS_ENUM(NSInteger, ALMargin) {
-
- ALMarginLeft = NSLayoutAttributeLeftMargin,
-
- ALMarginRight = NSLayoutAttributeRightMargin,
-
- ALMarginTop = NSLayoutAttributeTopMargin,
-
- ALMarginBottom = NSLayoutAttributeBottomMargin,
-
- ALMarginLeading = NSLayoutAttributeLeadingMargin,
-
- ALMarginTrailing = NSLayoutAttributeTrailingMargin
- };
- typedef NS_ENUM(NSInteger, ALMarginAxis) {
-
- ALMarginAxisVertical = NSLayoutAttributeCenterXWithinMargins,
-
- ALMarginAxisHorizontal = NSLayoutAttributeCenterYWithinMargins
- };
- #endif
- typedef NS_ENUM(NSInteger, ALAttribute) {
-
- ALAttributeLeft = ALEdgeLeft,
-
- ALAttributeRight = ALEdgeRight,
-
- ALAttributeTop = ALEdgeTop,
-
- ALAttributeBottom = ALEdgeBottom,
-
- ALAttributeLeading = ALEdgeLeading,
-
- ALAttributeTrailing = ALEdgeTrailing,
-
- ALAttributeWidth = ALDimensionWidth,
-
- ALAttributeHeight = ALDimensionHeight,
-
- ALAttributeVertical = ALAxisVertical,
-
- ALAttributeHorizontal = ALAxisHorizontal,
-
- ALAttributeBaseline = ALAxisBaseline,
-
- ALAttributeLastBaseline = ALAxisLastBaseline,
- #if PL__PureLayout_MinBaseSDK_iOS_8_0
-
- ALAttributeFirstBaseline = ALAxisFirstBaseline,
-
- ALAttributeMarginLeft = ALMarginLeft,
-
- ALAttributeMarginRight = ALMarginRight,
-
- ALAttributeMarginTop = ALMarginTop,
-
- ALAttributeMarginBottom = ALMarginBottom,
-
- ALAttributeMarginLeading = ALMarginLeading,
-
- ALAttributeMarginTrailing = ALMarginTrailing,
-
- ALAttributeMarginAxisVertical = ALMarginAxisVertical,
-
- ALAttributeMarginAxisHorizontal = ALMarginAxisHorizontal
- #endif
- };
- typedef void(^ALConstraintsBlock)(void);
- #endif
|