Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions AsyncDisplayKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2443,14 +2443,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES_ERROR;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES_ERROR;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -2488,14 +2494,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES_ERROR;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES_ERROR;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -2631,14 +2643,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES_ERROR;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES_ERROR;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## master
* Add your own contributions to the next release on the line below this with your name.
- [iOS11] Update project settings and fix errors [Eke](https://github.com/Eke) [#676](https://github.com/TextureGroup/Texture/pull/676)
- [ASCollectionView] Improve performance and behavior of rotation / bounds changes. [Scott Goodson](https://github.com/appleguy) [#431](https://github.com/TextureGroup/Texture/pull/431)
- [ASCollectionView] Improve index space translation of Flow Layout Delegate methods. [Scott Goodson](https://github.com/appleguy)
- [Animated Image] Adds support for animated WebP as well as improves GIF handling. [#605](https://github.com/TextureGroup/Texture/pull/605) [Garrett Moon](https://github.com/garrettmoon)
Expand Down
4 changes: 2 additions & 2 deletions Source/ASCollectionView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ - (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionV
// Experiments done by Instagram show that this option being YES (default)
// when unused causes a significant hit to scroll performance.
// https://github.com/Instagram/IGListKit/issues/318
if (AS_AT_LEAST_IOS10) {
if (AS_AVAILABLE_IOS(10)) {
super.prefetchingEnabled = NO;
}

Expand Down Expand Up @@ -1972,7 +1972,7 @@ - (ASRangeController *)rangeController
/// The UIKit version of this method is only available on iOS >= 9
- (NSArray<NSIndexPath *> *)asdk_indexPathsForVisibleSupplementaryElementsOfKind:(NSString *)kind
{
if (NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_9_0) {
if (AS_AVAILABLE_IOS(9)) {
return [self indexPathsForVisibleSupplementaryElementsOfKind:kind];
}

Expand Down
2 changes: 1 addition & 1 deletion Source/ASDisplayNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ extern NSInteger const ASDefaultDrawingPriority;
*/
@property (nonatomic, assign) UIViewContentMode contentMode; // default=UIViewContentModeScaleToFill
@property (nonatomic, copy) NSString *contentsGravity; // Use .contentMode in preference when possible.
@property (nonatomic, assign) UISemanticContentAttribute semanticContentAttribute; // default=Unspecified
@property (nonatomic, assign) UISemanticContentAttribute semanticContentAttribute API_AVAILABLE(ios(9.0), tvos(9.0)); // default=Unspecified

@property (nonatomic, nullable) CGColorRef shadowColor; // default=opaque rgb black
@property (nonatomic, assign) CGFloat shadowOpacity; // default=0.0
Expand Down
2 changes: 1 addition & 1 deletion Source/ASImageNode+AnimatedImage.mm
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ - (void)displayLinkFired:(CADisplayLink *)displayLink
CFTimeInterval timeBetweenLastFire;
if (self.lastDisplayLinkFire == 0) {
timeBetweenLastFire = 0;
} else if (AS_AT_LEAST_IOS10){
} else if (AS_AVAILABLE_IOS(10)){
timeBetweenLastFire = displayLink.targetTimestamp - displayLink.timestamp;
} else {
timeBetweenLastFire = CACurrentMediaTime() - self.lastDisplayLinkFire;
Expand Down
2 changes: 1 addition & 1 deletion Source/ASTextNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ - (id)linkAttributeValueAtPoint:(CGPoint)point
}

- (id)_linkAttributeValueAtPoint:(CGPoint)point
attributeName:(out NSString **)attributeNameOut
attributeName:(out NSString * __autoreleasing *)attributeNameOut
range:(out NSRange *)rangeOut
inAdditionalTruncationMessage:(out BOOL *)inAdditionalTruncationMessageOut
forHighlighting:(BOOL)highlighting
Expand Down
43 changes: 38 additions & 5 deletions Source/Base/ASLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,44 @@ ASDISPLAYNODE_EXTERN_C_END
* The logging macros are not guarded by deployment-target checks like the activity macros are, but they are
* only available on iOS >= 9 at runtime, so just make them conditional.
*/
#define as_log_create(subsystem, category) (AS_AT_LEAST_IOS9 ? os_log_create(subsystem, category) : (os_log_t)0)
#define as_log_debug(log, format, ...) (AS_AT_LEAST_IOS9 ? os_log_debug(log, format, ##__VA_ARGS__) : (void)0)
#define as_log_info(log, format, ...) (AS_AT_LEAST_IOS9 ? os_log_info(log, format, ##__VA_ARGS__) : (void)0)
#define as_log_error(log, format, ...) (AS_AT_LEAST_IOS9 ? os_log_error(log, format, ##__VA_ARGS__) : (void)0)
#define as_log_fault(log, format, ...) (AS_AT_LEAST_IOS9 ? os_log_fault(log, format, ##__VA_ARGS__) : (void)0)

#define as_log_create(subsystem, category) ({ \
os_log_t __val; \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the rest of the macros need to pass through their return value as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If i did not miss anything, other macros don't need to pass through their return value as well.

if (AS_AVAILABLE_IOS(9)) { \
__val = os_log_create(subsystem, category); \
} else { \
__val = (os_log_t)0; \
} \
__val; \
})

#define as_log_debug(log, format, ...) \
if (AS_AVAILABLE_IOS(9)) { \
os_log_debug(log, format, ##__VA_ARGS__); \
} else { \
(void)0; \
} \

#define as_log_info(log, format, ...) \
if (AS_AVAILABLE_IOS(9)) { \
os_log_info(log, format, ##__VA_ARGS__); \
} else { \
(void)0; \
} \

#define as_log_error(log, format, ...) \
if (AS_AVAILABLE_IOS(9)) { \
os_log_error(log, format, ##__VA_ARGS__); \
} else { \
(void)0; \
} \

#define as_log_fault(log, format, ...) \
if (AS_AVAILABLE_IOS(9)) { \
os_log_fault(log, format, ##__VA_ARGS__); \
} else { \
(void)0; \
} \

#if ASEnableVerboseLogging
#define as_log_verbose(log, format, ...) as_log_debug(log, format, ##__VA_ARGS__)
Expand Down
2 changes: 1 addition & 1 deletion Source/Details/ASDataController.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ extern NSString * const ASCollectionInvalidUpdateException;
* The invalidationBlock is called after flushing the ASMainSerialQueue, which ensures that any in-progress
* layout calculations have been applied. The block will not be called if data hasn't been loaded.
*/
- (void)relayoutAllNodesWithInvalidationBlock:(nullable void (^)())invalidationBlock;
- (void)relayoutAllNodesWithInvalidationBlock:(nullable void (^)(void))invalidationBlock;

/**
* Re-measures given nodes in the backing store.
Expand Down
2 changes: 1 addition & 1 deletion Source/Details/ASPINRemoteImageDownloader.m
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ - (id)alternateRepresentationWithData:(NSData *)data options:(PINRemoteImageMana
* If queue is nil, assert and perform now.
* Otherwise, dispatch async to queue.
*/
+ (void)_performWithCallbackQueue:(dispatch_queue_t)queue work:(void (^)())work
+ (void)_performWithCallbackQueue:(dispatch_queue_t)queue work:(void (^)(void))work
{
if (work == nil) {
// No need to assert here, really. We aren't expecting any feedback from this method.
Expand Down
40 changes: 27 additions & 13 deletions Source/Details/ASTraitCollection.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ASPrimitiveTraitCollection ASPrimitiveTraitCollectionFromUITraitCollection(UITra
environmentTraitCollection.horizontalSizeClass = traitCollection.horizontalSizeClass;
environmentTraitCollection.verticalSizeClass = traitCollection.verticalSizeClass;
environmentTraitCollection.userInterfaceIdiom = traitCollection.userInterfaceIdiom;
if (AS_AT_LEAST_IOS9) {
if (AS_AVAILABLE_IOS(9)) {
environmentTraitCollection.forceTouchCapability = traitCollection.forceTouchCapability;
}
return environmentTraitCollection;
Expand All @@ -67,17 +67,28 @@ 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) {
switch (idiom) {
case UIUserInterfaceIdiomTV:
return @"TV";
case UIUserInterfaceIdiomPad:
return @"Pad";
case UIUserInterfaceIdiomPhone:
return @"Phone";
case UIUserInterfaceIdiomCarPlay:
return @"CarPlay";
default:
return @"Unspecified";
if (AS_AVAILABLE_IOS(9)) {
switch (idiom) {
case UIUserInterfaceIdiomTV:
return @"TV";
case UIUserInterfaceIdiomPad:
return @"Pad";
case UIUserInterfaceIdiomPhone:
return @"Phone";
case UIUserInterfaceIdiomCarPlay:
return @"CarPlay";
default:
return @"Unspecified";
}
} else {
switch (idiom) {
case UIUserInterfaceIdiomPad:
return @"Pad";
case UIUserInterfaceIdiomPhone:
return @"Phone";
default:
return @"Unspecified";
}
}
}

Expand Down Expand Up @@ -167,7 +178,10 @@ + (instancetype)traitCollectionWithASPrimitiveTraitCollection:(ASPrimitiveTraitC
+ (instancetype)traitCollectionWithUITraitCollection:(UITraitCollection *)traitCollection
containerSize:(CGSize)windowSize
{
UIForceTouchCapability forceTouch = AS_AT_LEAST_IOS9 ? traitCollection.forceTouchCapability : UIForceTouchCapabilityUnknown;
UIForceTouchCapability forceTouch = UIForceTouchCapabilityUnknown;
if(AS_AVAILABLE_IOS(9)) {
forceTouch = traitCollection.forceTouchCapability;
}
return [self traitCollectionWithDisplayScale:traitCollection.displayScale
userInterfaceIdiom:traitCollection.userInterfaceIdiom
horizontalSizeClass:traitCollection.horizontalSizeClass
Expand Down
2 changes: 1 addition & 1 deletion Source/Details/UIView+ASConvenience.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) CGRect bounds;
@property (nonatomic, assign) CGRect frame; // Only for use with nodes wrapping synchronous views
@property (nonatomic, assign) UIViewContentMode contentMode;
@property (nonatomic, assign) UISemanticContentAttribute semanticContentAttribute;
@property (nonatomic, assign) UISemanticContentAttribute semanticContentAttribute API_AVAILABLE(ios(9.0), tvos(9.0));
@property (nonatomic, assign, getter=isUserInteractionEnabled) BOOL userInteractionEnabled;
@property (nonatomic, assign, getter=isExclusiveTouch) BOOL exclusiveTouch;
@property (nonatomic, assign, getter=asyncdisplaykit_isAsyncTransactionContainer, setter = asyncdisplaykit_setAsyncTransactionContainer:) BOOL asyncdisplaykit_asyncTransactionContainer;
Expand Down
2 changes: 1 addition & 1 deletion Source/Private/ASTableView+Undeprecated.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ NS_ASSUME_NONNULL_BEGIN
* the main thread.
* @warning This method is substantially more expensive than UITableView's version.
*/
-(void)reloadDataWithCompletion:(void (^ _Nullable)())completion;
-(void)reloadDataWithCompletion:(void (^ _Nullable)(void))completion;

/**
* Reload everything from scratch, destroying the working range and all cached nodes.
Expand Down
18 changes: 12 additions & 6 deletions Source/Private/_ASPendingState.mm
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ @implementation _ASPendingState
NSArray *accessibilityHeaderElements;
CGPoint accessibilityActivationPoint;
UIBezierPath *accessibilityPath;
UISemanticContentAttribute semanticContentAttribute;
UISemanticContentAttribute semanticContentAttribute API_AVAILABLE(ios(9.0), tvos(9.0));

ASPendingStateFlags _flags;
}
Expand Down Expand Up @@ -295,7 +295,9 @@ - (instancetype)init
accessibilityActivationPoint = CGPointZero;
accessibilityPath = nil;
edgeAntialiasingMask = (kCALayerLeftEdge | kCALayerRightEdge | kCALayerTopEdge | kCALayerBottomEdge);
semanticContentAttribute = UISemanticContentAttributeUnspecified;
if (AS_AVAILABLE_IOS(9)) {
semanticContentAttribute = UISemanticContentAttributeUnspecified;
}

return self;
}
Expand Down Expand Up @@ -573,7 +575,7 @@ - (void)asyncdisplaykit_setAsyncTransactionContainer:(BOOL)flag
_flags.setAsyncTransactionContainer = YES;
}

- (void)setSemanticContentAttribute:(UISemanticContentAttribute)attribute {
- (void)setSemanticContentAttribute:(UISemanticContentAttribute)attribute API_AVAILABLE(ios(9.0), tvos(9.0)) {
semanticContentAttribute = attribute;
_flags.setSemanticContentAttribute = YES;
}
Expand Down Expand Up @@ -1049,8 +1051,10 @@ - (void)applyToView:(UIView *)view withSpecialPropertiesHandling:(BOOL)specialPr
if (flags.setOpaque)
ASDisplayNodeAssert(layer.opaque == opaque, @"Didn't set opaque as desired");

if (flags.setSemanticContentAttribute) {
view.semanticContentAttribute = semanticContentAttribute;
if (AS_AVAILABLE_IOS(9)) {
if (flags.setSemanticContentAttribute) {
view.semanticContentAttribute = semanticContentAttribute;
}
}

if (flags.setIsAccessibilityElement)
Expand Down Expand Up @@ -1211,7 +1215,9 @@ + (_ASPendingState *)pendingViewStateFromView:(UIView *)view
pendingState.allowsGroupOpacity = layer.allowsGroupOpacity;
pendingState.allowsEdgeAntialiasing = layer.allowsEdgeAntialiasing;
pendingState.edgeAntialiasingMask = layer.edgeAntialiasingMask;
pendingState.semanticContentAttribute = view.semanticContentAttribute;
if (AS_AVAILABLE_IOS(9)) {
pendingState.semanticContentAttribute = view.semanticContentAttribute;
}
pendingState.isAccessibilityElement = view.isAccessibilityElement;
pendingState.accessibilityLabel = view.accessibilityLabel;
pendingState.accessibilityHint = view.accessibilityHint;
Expand Down
4 changes: 2 additions & 2 deletions Tests/ASDisplayLayerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ @interface _ASDisplayLayerTestDelegate : ASDisplayNode <_ASDisplayLayerDelegate>

// for _ASDisplayLayerTestDelegateModeClassDisplay
@property (nonatomic, assign) NSUInteger displayCount;
@property (nonatomic, copy) UIImage *(^displayLayerBlock)();
@property (nonatomic, copy) UIImage *(^displayLayerBlock)(void);

// for _ASDisplayLayerTestDelegateModeClassDrawInContext
@property (nonatomic, assign) NSUInteger drawRectCount;
Expand Down Expand Up @@ -472,7 +472,7 @@ - (void)DISABLED_testTransaction
layer1.displaysAsynchronously = YES;

dispatch_semaphore_t displayAsyncLayer1Sema = dispatch_semaphore_create(0);
layer1Delegate.displayLayerBlock = ^(_ASDisplayLayer *asyncLayer) {
layer1Delegate.displayLayerBlock = ^UIImage *{

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this one, tests are green but..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks right to me :)

dispatch_semaphore_wait(displayAsyncLayer1Sema, DISPATCH_TIME_FOREVER);
return bogusImage();
};
Expand Down
Loading