Browse Source

Merge pull request #286 from mariohahn/master

Added TVOS
Jonas Budelmann 9 years ago
parent
commit
a998be6996

+ 12 - 1
Masonry.podspec

@@ -1,6 +1,6 @@
 Pod::Spec.new do |s|
 Pod::Spec.new do |s|
   s.name     = 'Masonry'
   s.name     = 'Masonry'
-  s.version  = '0.6.3'
+  s.version  = '0.6.4'
   s.license  = 'MIT'
   s.license  = 'MIT'
   s.summary  = 'Harness the power of Auto Layout NSLayoutConstraints with a simplified, chainable and expressive syntax.'
   s.summary  = 'Harness the power of Auto Layout NSLayoutConstraints with a simplified, chainable and expressive syntax.'
   s.homepage = 'https://github.com/cloudkite/Masonry'
   s.homepage = 'https://github.com/cloudkite/Masonry'
@@ -16,12 +16,23 @@ Pod::Spec.new do |s|
     Masonry supports iOS and Mac OSX.
     Masonry supports iOS and Mac OSX.
   }
   }
 
 
+  pch_AF = <<-EOS
+    #ifndef TARGET_OS_IOS
+        #define TARGET_OS_IOS TARGET_OS_IPHONE
+    #endif
+    #ifndef TARGET_OS_TV
+        #define TARGET_OS_TV 0
+    #endif
+  EOS
+
   s.source_files = 'Masonry/*.{h,m}'
   s.source_files = 'Masonry/*.{h,m}'
 
 
   s.ios.frameworks = 'Foundation', 'UIKit'
   s.ios.frameworks = 'Foundation', 'UIKit'
+  s.tvos.frameworks = 'Foundation', 'UIKit'
   s.osx.frameworks = 'Foundation', 'AppKit'
   s.osx.frameworks = 'Foundation', 'AppKit'
 
 
   s.ios.deployment_target = '6.0' # minimum SDK with autolayout
   s.ios.deployment_target = '6.0' # minimum SDK with autolayout
   s.osx.deployment_target = '10.7' # minimum SDK with autolayout
   s.osx.deployment_target = '10.7' # minimum SDK with autolayout
+  s.tvos.deployment_target = '9.0' # minimum SDK with autolayout
   s.requires_arc = true
   s.requires_arc = true
 end
 end

+ 1 - 1
Masonry/MASCompositeConstraint.m

@@ -97,7 +97,7 @@
 
 
 #pragma mark - Animator proxy
 #pragma mark - Animator proxy
 
 
-#if TARGET_OS_MAC && !TARGET_OS_IPHONE
+#if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV)
 
 
 - (MASConstraint *)animator {
 - (MASConstraint *)animator {
     for (MASConstraint *constraint in self.childConstraints) {
     for (MASConstraint *constraint in self.childConstraints) {

+ 2 - 2
Masonry/MASConstraint.h

@@ -127,7 +127,7 @@
 - (MASConstraint *)centerY;
 - (MASConstraint *)centerY;
 - (MASConstraint *)baseline;
 - (MASConstraint *)baseline;
 
 
-#if TARGET_OS_IPHONE
+#if TARGET_OS_IPHONE || TARGET_OS_TV
 
 
 - (MASConstraint *)leftMargin;
 - (MASConstraint *)leftMargin;
 - (MASConstraint *)rightMargin;
 - (MASConstraint *)rightMargin;
@@ -178,7 +178,7 @@
 
 
 // NSLayoutConstraint Installation support
 // NSLayoutConstraint Installation support
 
 
-#if TARGET_OS_MAC && !TARGET_OS_IPHONE
+#if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV)
 /**
 /**
  *  Whether or not to go through the animator proxy when modifying the constraint
  *  Whether or not to go through the animator proxy when modifying the constraint
  */
  */

+ 2 - 2
Masonry/MASConstraint.m

@@ -208,7 +208,7 @@
     return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBaseline];
     return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBaseline];
 }
 }
 
 
-#if TARGET_OS_IPHONE
+#if TARGET_OS_IPHONE || TARGET_OS_TV
 
 
 - (MASConstraint *)leftMargin {
 - (MASConstraint *)leftMargin {
     return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeftMargin];
     return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeftMargin];
@@ -264,7 +264,7 @@
 
 
 - (void)setOffset:(CGFloat __unused)offset { MASMethodNotImplemented(); }
 - (void)setOffset:(CGFloat __unused)offset { MASMethodNotImplemented(); }
 
 
-#if TARGET_OS_MAC && !TARGET_OS_IPHONE
+#if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV)
 
 
 - (MASConstraint *)animator { MASMethodNotImplemented(); }
 - (MASConstraint *)animator { MASMethodNotImplemented(); }
 
 

+ 2 - 2
Masonry/MASConstraintMaker.h

@@ -22,7 +22,7 @@ typedef NS_OPTIONS(NSInteger, MASAttribute) {
     MASAttributeCenterY = 1 << NSLayoutAttributeCenterY,
     MASAttributeCenterY = 1 << NSLayoutAttributeCenterY,
     MASAttributeBaseline = 1 << NSLayoutAttributeBaseline,
     MASAttributeBaseline = 1 << NSLayoutAttributeBaseline,
     
     
-#if TARGET_OS_IPHONE
+#if TARGET_OS_IPHONE || TARGET_OS_TV
     
     
     MASAttributeLeftMargin = 1 << NSLayoutAttributeLeftMargin,
     MASAttributeLeftMargin = 1 << NSLayoutAttributeLeftMargin,
     MASAttributeRightMargin = 1 << NSLayoutAttributeRightMargin,
     MASAttributeRightMargin = 1 << NSLayoutAttributeRightMargin,
@@ -60,7 +60,7 @@ typedef NS_OPTIONS(NSInteger, MASAttribute) {
 @property (nonatomic, strong, readonly) MASConstraint *centerY;
 @property (nonatomic, strong, readonly) MASConstraint *centerY;
 @property (nonatomic, strong, readonly) MASConstraint *baseline;
 @property (nonatomic, strong, readonly) MASConstraint *baseline;
 
 
-#if TARGET_OS_IPHONE
+#if TARGET_OS_IPHONE || TARGET_OS_TV
 
 
 @property (nonatomic, strong, readonly) MASConstraint *leftMargin;
 @property (nonatomic, strong, readonly) MASConstraint *leftMargin;
 @property (nonatomic, strong, readonly) MASConstraint *rightMargin;
 @property (nonatomic, strong, readonly) MASConstraint *rightMargin;

+ 3 - 3
Masonry/MASConstraintMaker.m

@@ -78,7 +78,7 @@
     __unused MASAttribute anyAttribute = (MASAttributeLeft | MASAttributeRight | MASAttributeTop | MASAttributeBottom | MASAttributeLeading
     __unused MASAttribute anyAttribute = (MASAttributeLeft | MASAttributeRight | MASAttributeTop | MASAttributeBottom | MASAttributeLeading
                                           | MASAttributeTrailing | MASAttributeWidth | MASAttributeHeight | MASAttributeCenterX
                                           | MASAttributeTrailing | MASAttributeWidth | MASAttributeHeight | MASAttributeCenterX
                                           | MASAttributeCenterY | MASAttributeBaseline
                                           | MASAttributeCenterY | MASAttributeBaseline
-#if TARGET_OS_IPHONE
+#if TARGET_OS_IPHONE || TARGET_OS_TV
                                           | MASAttributeLeftMargin | MASAttributeRightMargin | MASAttributeTopMargin | MASAttributeBottomMargin
                                           | MASAttributeLeftMargin | MASAttributeRightMargin | MASAttributeTopMargin | MASAttributeBottomMargin
                                           | MASAttributeLeadingMargin | MASAttributeTrailingMargin | MASAttributeCenterXWithinMargins
                                           | MASAttributeLeadingMargin | MASAttributeTrailingMargin | MASAttributeCenterXWithinMargins
                                           | MASAttributeCenterYWithinMargins
                                           | MASAttributeCenterYWithinMargins
@@ -101,7 +101,7 @@
     if (attrs & MASAttributeCenterY) [attributes addObject:self.view.mas_centerY];
     if (attrs & MASAttributeCenterY) [attributes addObject:self.view.mas_centerY];
     if (attrs & MASAttributeBaseline) [attributes addObject:self.view.mas_baseline];
     if (attrs & MASAttributeBaseline) [attributes addObject:self.view.mas_baseline];
     
     
-#if TARGET_OS_IPHONE
+#if TARGET_OS_IPHONE || TARGET_OS_TV
     
     
     if (attrs & MASAttributeLeftMargin) [attributes addObject:self.view.mas_leftMargin];
     if (attrs & MASAttributeLeftMargin) [attributes addObject:self.view.mas_leftMargin];
     if (attrs & MASAttributeRightMargin) [attributes addObject:self.view.mas_rightMargin];
     if (attrs & MASAttributeRightMargin) [attributes addObject:self.view.mas_rightMargin];
@@ -182,7 +182,7 @@
     };
     };
 }
 }
 
 
-#if TARGET_OS_IPHONE
+#if TARGET_OS_IPHONE || TARGET_OS_TV
 
 
 - (MASConstraint *)leftMargin {
 - (MASConstraint *)leftMargin {
     return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeftMargin];
     return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeftMargin];

+ 3 - 1
Masonry/MASUtilities.h

@@ -8,7 +8,9 @@
 
 
 #import <Foundation/Foundation.h>
 #import <Foundation/Foundation.h>
 
 
-#if TARGET_OS_IPHONE
+
+
+#if TARGET_OS_IPHONE || TARGET_OS_TV
 
 
     #import <UIKit/UIKit.h>
     #import <UIKit/UIKit.h>
     #define MAS_VIEW UIView
     #define MAS_VIEW UIView

+ 2 - 2
Masonry/MASViewConstraint.m

@@ -86,7 +86,7 @@ static char kInstalledConstraintsKey;
 - (void)setLayoutConstant:(CGFloat)layoutConstant {
 - (void)setLayoutConstant:(CGFloat)layoutConstant {
     _layoutConstant = layoutConstant;
     _layoutConstant = layoutConstant;
 
 
-#if TARGET_OS_MAC && !TARGET_OS_IPHONE
+#if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV)
     if (self.useAnimator) {
     if (self.useAnimator) {
         [self.layoutConstraint.animator setConstant:layoutConstant];
         [self.layoutConstraint.animator setConstant:layoutConstant];
     } else {
     } else {
@@ -211,7 +211,7 @@ static char kInstalledConstraintsKey;
 
 
 #pragma mark - Animator proxy
 #pragma mark - Animator proxy
 
 
-#if TARGET_OS_MAC && !TARGET_OS_IPHONE
+#if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV)
 
 
 - (MASConstraint *)animator {
 - (MASConstraint *)animator {
     self.useAnimator = YES;
     self.useAnimator = YES;

+ 2 - 2
Masonry/NSLayoutConstraint+MASDebugAdditions.m

@@ -44,7 +44,7 @@
             @(NSLayoutAttributeCenterY)  : @"centerY",
             @(NSLayoutAttributeCenterY)  : @"centerY",
             @(NSLayoutAttributeBaseline) : @"baseline",
             @(NSLayoutAttributeBaseline) : @"baseline",
             
             
-#if TARGET_OS_IPHONE
+#if TARGET_OS_IPHONE || TARGET_OS_TV
             @(NSLayoutAttributeLeftMargin)           : @"leftMargin",
             @(NSLayoutAttributeLeftMargin)           : @"leftMargin",
             @(NSLayoutAttributeRightMargin)          : @"rightMargin",
             @(NSLayoutAttributeRightMargin)          : @"rightMargin",
             @(NSLayoutAttributeTopMargin)            : @"topMargin",
             @(NSLayoutAttributeTopMargin)            : @"topMargin",
@@ -66,7 +66,7 @@
     static dispatch_once_t once;
     static dispatch_once_t once;
     static NSDictionary *descriptionMap;
     static NSDictionary *descriptionMap;
     dispatch_once(&once, ^{
     dispatch_once(&once, ^{
-#if TARGET_OS_IPHONE
+#if TARGET_OS_IPHONE || TARGET_OS_TV
         descriptionMap = @{
         descriptionMap = @{
             @(MASLayoutPriorityDefaultHigh)      : @"high",
             @(MASLayoutPriorityDefaultHigh)      : @"high",
             @(MASLayoutPriorityDefaultLow)       : @"low",
             @(MASLayoutPriorityDefaultLow)       : @"low",

+ 1 - 1
Masonry/View+MASAdditions.h

@@ -32,7 +32,7 @@
 @property (nonatomic, strong, readonly) MASViewAttribute *mas_baseline;
 @property (nonatomic, strong, readonly) MASViewAttribute *mas_baseline;
 @property (nonatomic, strong, readonly) MASViewAttribute *(^mas_attribute)(NSLayoutAttribute attr);
 @property (nonatomic, strong, readonly) MASViewAttribute *(^mas_attribute)(NSLayoutAttribute attr);
 
 
-#if TARGET_OS_IPHONE
+#if TARGET_OS_IPHONE || TARGET_OS_TV
 
 
 @property (nonatomic, strong, readonly) MASViewAttribute *mas_leftMargin;
 @property (nonatomic, strong, readonly) MASViewAttribute *mas_leftMargin;
 @property (nonatomic, strong, readonly) MASViewAttribute *mas_rightMargin;
 @property (nonatomic, strong, readonly) MASViewAttribute *mas_rightMargin;

+ 1 - 1
Masonry/View+MASAdditions.m

@@ -87,7 +87,7 @@
     };
     };
 }
 }
 
 
-#if TARGET_OS_IPHONE
+#if TARGET_OS_IPHONE || TARGET_OS_TV
 
 
 - (MASViewAttribute *)mas_leftMargin {
 - (MASViewAttribute *)mas_leftMargin {
     return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeftMargin];
     return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeftMargin];

+ 2 - 2
Masonry/View+MASShorthandAdditions.h

@@ -29,7 +29,7 @@
 @property (nonatomic, strong, readonly) MASViewAttribute *baseline;
 @property (nonatomic, strong, readonly) MASViewAttribute *baseline;
 @property (nonatomic, strong, readonly) MASViewAttribute *(^attribute)(NSLayoutAttribute attr);
 @property (nonatomic, strong, readonly) MASViewAttribute *(^attribute)(NSLayoutAttribute attr);
 
 
-#if TARGET_OS_IPHONE
+#if TARGET_OS_IPHONE || TARGET_OS_TV
 
 
 @property (nonatomic, strong, readonly) MASViewAttribute *leftMargin;
 @property (nonatomic, strong, readonly) MASViewAttribute *leftMargin;
 @property (nonatomic, strong, readonly) MASViewAttribute *rightMargin;
 @property (nonatomic, strong, readonly) MASViewAttribute *rightMargin;
@@ -67,7 +67,7 @@ MAS_ATTR_FORWARD(centerX);
 MAS_ATTR_FORWARD(centerY);
 MAS_ATTR_FORWARD(centerY);
 MAS_ATTR_FORWARD(baseline);
 MAS_ATTR_FORWARD(baseline);
 
 
-#if TARGET_OS_IPHONE
+#if TARGET_OS_IPHONE || TARGET_OS_TV
 
 
 MAS_ATTR_FORWARD(leftMargin);
 MAS_ATTR_FORWARD(leftMargin);
 MAS_ATTR_FORWARD(rightMargin);
 MAS_ATTR_FORWARD(rightMargin);