diff --git a/Source/ASCollectionView.mm b/Source/ASCollectionView.mm index c011f3145..c614f6084 100644 --- a/Source/ASCollectionView.mm +++ b/Source/ASCollectionView.mm @@ -1974,7 +1974,7 @@ - (ASRangeController *)rangeController /// The UIKit version of this method is only available on iOS >= 9 - (NSArray *)asdk_indexPathsForVisibleSupplementaryElementsOfKind:(NSString *)kind { - if (AS_AVAILABLE_IOS(9)) { + if (AS_AVAILABLE_IOS_TVOS(9, 9)) { return [self indexPathsForVisibleSupplementaryElementsOfKind:kind]; } diff --git a/Source/Base/ASAvailability.h b/Source/Base/ASAvailability.h index 77ac35b29..eb6af2ac2 100644 --- a/Source/Base/ASAvailability.h +++ b/Source/Base/ASAvailability.h @@ -45,9 +45,9 @@ #define AS_AVAILABLE_TVOS(ver) __builtin_available(tvOS ver, *) #define AS_AVAILABLE_IOS_TVOS(ver1, ver2) __builtin_available(iOS ver1, tvOS ver2, *) #else - #define AS_AVAILABLE_IOS(ver) AS_AT_LEAST_IOS##ver - #define AS_AVAILABLE_TVOS(ver) AS_AT_LEAST_IOS##ver - #define AS_AVAILABLE_IOS_TVOS(ver1, ver2) AS_AT_LEAST_IOS##ver1 || AS_AT_LEAST_IOS##ver2 + #define AS_AVAILABLE_IOS(ver) (TARGET_OS_IOS && AS_AT_LEAST_IOS##ver) + #define AS_AVAILABLE_TVOS(ver) (TARGET_OS_TV && AS_AT_LEAST_IOS##ver) + #define AS_AVAILABLE_IOS_TVOS(ver1, ver2) (AS_AVAILABLE_IOS(ver1) || AS_AVAILABLE_TVOS(ver2)) #endif // If Yoga is available, make it available anywhere we use ASAvailability. diff --git a/Source/Base/ASLog.h b/Source/Base/ASLog.h index c6aba76ba..e87404631 100644 --- a/Source/Base/ASLog.h +++ b/Source/Base/ASLog.h @@ -132,7 +132,7 @@ ASDISPLAYNODE_EXTERN_C_END #define as_log_create(subsystem, category) ({ \ os_log_t __val; \ -if (AS_AVAILABLE_IOS(9)) { \ +if (AS_AVAILABLE_IOS_TVOS(9, 9)) { \ __val = os_log_create(subsystem, category); \ } else { \ __val = (os_log_t)0; \ @@ -141,28 +141,28 @@ __val; \ }) #define as_log_debug(log, format, ...) \ -if (AS_AVAILABLE_IOS(9)) { \ +if (AS_AVAILABLE_IOS_TVOS(9, 9)) { \ os_log_debug(log, format, ##__VA_ARGS__); \ } else { \ (void)0; \ } \ #define as_log_info(log, format, ...) \ -if (AS_AVAILABLE_IOS(9)) { \ +if (AS_AVAILABLE_IOS_TVOS(9, 9)) { \ os_log_info(log, format, ##__VA_ARGS__); \ } else { \ (void)0; \ } \ #define as_log_error(log, format, ...) \ -if (AS_AVAILABLE_IOS(9)) { \ +if (AS_AVAILABLE_IOS_TVOS(9, 9)) { \ os_log_error(log, format, ##__VA_ARGS__); \ } else { \ (void)0; \ } \ #define as_log_fault(log, format, ...) \ -if (AS_AVAILABLE_IOS(9)) { \ +if (AS_AVAILABLE_IOS_TVOS(9, 9)) { \ os_log_fault(log, format, ##__VA_ARGS__); \ } else { \ (void)0; \ diff --git a/Source/Details/ASTraitCollection.m b/Source/Details/ASTraitCollection.m index 04eaea608..1309b9265 100644 --- a/Source/Details/ASTraitCollection.m +++ b/Source/Details/ASTraitCollection.m @@ -67,7 +67,7 @@ BOOL ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(ASPrimitiveTr // Named so as not to conflict with a hidden Apple function, in case compiler decides not to inline ASDISPLAYNODE_INLINE NSString *AS_NSStringFromUIUserInterfaceIdiom(UIUserInterfaceIdiom idiom) { - if (AS_AVAILABLE_IOS(9)) { + if (AS_AVAILABLE_IOS_TVOS(9, 9)) { switch (idiom) { case UIUserInterfaceIdiomTV: return @"TV"; diff --git a/Source/Private/_ASPendingState.mm b/Source/Private/_ASPendingState.mm index 21f6abead..ea8834f70 100644 --- a/Source/Private/_ASPendingState.mm +++ b/Source/Private/_ASPendingState.mm @@ -295,7 +295,7 @@ - (instancetype)init accessibilityActivationPoint = CGPointZero; accessibilityPath = nil; edgeAntialiasingMask = (kCALayerLeftEdge | kCALayerRightEdge | kCALayerTopEdge | kCALayerBottomEdge); - if (AS_AVAILABLE_IOS(9)) { + if (AS_AVAILABLE_IOS_TVOS(9, 9)) { semanticContentAttribute = UISemanticContentAttributeUnspecified; } @@ -1051,7 +1051,7 @@ - (void)applyToView:(UIView *)view withSpecialPropertiesHandling:(BOOL)specialPr if (flags.setOpaque) ASDisplayNodeAssert(layer.opaque == opaque, @"Didn't set opaque as desired"); - if (AS_AVAILABLE_IOS(9)) { + if (AS_AVAILABLE_IOS_TVOS(9, 9)) { if (flags.setSemanticContentAttribute) { view.semanticContentAttribute = semanticContentAttribute; } @@ -1215,7 +1215,7 @@ + (_ASPendingState *)pendingViewStateFromView:(UIView *)view pendingState.allowsGroupOpacity = layer.allowsGroupOpacity; pendingState.allowsEdgeAntialiasing = layer.allowsEdgeAntialiasing; pendingState.edgeAntialiasingMask = layer.edgeAntialiasingMask; - if (AS_AVAILABLE_IOS(9)) { + if (AS_AVAILABLE_IOS_TVOS(9, 9)) { pendingState.semanticContentAttribute = view.semanticContentAttribute; } pendingState.isAccessibilityElement = view.isAccessibilityElement;