Standardize "extern" decls on AS_EXTERN (#972)

* Standardize "extern" decls on AS_EXTERN

* Rebase & remove from implementation files
This commit is contained in:
Adlai Holler
2018-06-18 15:53:34 -07:00
committed by GitHub
parent 69e0c096e1
commit dbe469a94a
61 changed files with 247 additions and 362 deletions

View File

@@ -8,6 +8,7 @@
- Make the main thread ivar deallocation system available to other classes. Plus a little optimization. See `ASMainThreadDeallocation.h`. [Adlai Holler](https://github.com/Adlai-Holler) [#959](https://github.com/TextureGroup/Texture/pull/959) - Make the main thread ivar deallocation system available to other classes. Plus a little optimization. See `ASMainThreadDeallocation.h`. [Adlai Holler](https://github.com/Adlai-Holler) [#959](https://github.com/TextureGroup/Texture/pull/959)
- Reduce usage of autorelease pools. [Adlai Holler](https://github.com/Adlai-Holler) [#968](https://github.com/TextureGroup/Texture/pull/968) - Reduce usage of autorelease pools. [Adlai Holler](https://github.com/Adlai-Holler) [#968](https://github.com/TextureGroup/Texture/pull/968)
- Clean up unused/unneeded header macros. [Adlai Holler](https://github.com/Adlai-Holler) - Clean up unused/unneeded header macros. [Adlai Holler](https://github.com/Adlai-Holler)
- Clean up C-function `extern` decorators. [Adlai Holler](https://github.com/Adlai-Holler)
## 2.7 ## 2.7
- Fix pager node for interface coalescing. [Max Wang](https://github.com/wsdwsd0829) [#877](https://github.com/TextureGroup/Texture/pull/877) - Fix pager node for interface coalescing. [Max Wang](https://github.com/wsdwsd0829) [#877](https://github.com/TextureGroup/Texture/pull/877)

View File

@@ -17,7 +17,6 @@
#import <AsyncDisplayKit/ASConfiguration.h> #import <AsyncDisplayKit/ASConfiguration.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
ASDISPLAYNODE_EXTERN_C_BEGIN
/** /**
* Quickly check if an experiment is enabled and notify the delegate * Quickly check if an experiment is enabled and notify the delegate
@@ -25,7 +24,7 @@ ASDISPLAYNODE_EXTERN_C_BEGIN
* *
* The delegate will be notified asynchronously. * The delegate will be notified asynchronously.
*/ */
BOOL ASActivateExperimentalFeature(ASExperimentalFeatures option); AS_EXTERN BOOL ASActivateExperimentalFeature(ASExperimentalFeatures option);
AS_SUBCLASSING_RESTRICTED AS_SUBCLASSING_RESTRICTED
@interface ASConfigurationManager : NSObject @interface ASConfigurationManager : NSObject
@@ -38,4 +37,3 @@ AS_SUBCLASSING_RESTRICTED
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
ASDISPLAYNODE_EXTERN_C_END

View File

@@ -22,8 +22,8 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
extern NSString * const ASTransitionContextFromLayoutKey; AS_EXTERN NSString * const ASTransitionContextFromLayoutKey;
extern NSString * const ASTransitionContextToLayoutKey; AS_EXTERN NSString * const ASTransitionContextToLayoutKey;
@protocol ASContextTransitioning <NSObject> @protocol ASContextTransitioning <NSObject>

View File

@@ -27,10 +27,8 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
ASDISPLAYNODE_EXTERN_C_BEGIN AS_EXTERN void ASPerformBlockOnMainThread(void (^block)(void));
void ASPerformBlockOnMainThread(void (^block)(void)); AS_EXTERN void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT
void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT
ASDISPLAYNODE_EXTERN_C_END
#if ASEVENTLOG_ENABLE #if ASEVENTLOG_ENABLE
#define ASDisplayNodeLogEvent(node, ...) [node.eventLog logEventWithBacktrace:(AS_SAVE_EVENT_BACKTRACES ? [NSThread callStackSymbols] : nil) format:__VA_ARGS__] #define ASDisplayNodeLogEvent(node, ...) [node.eventLog logEventWithBacktrace:(AS_SAVE_EVENT_BACKTRACES ? [NSThread callStackSymbols] : nil) format:__VA_ARGS__]
@@ -167,7 +165,7 @@ typedef struct {
#if YOGA #if YOGA
extern void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode * _Nullable node, void(^block)(ASDisplayNode *node)); AS_EXTERN void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode * _Nullable node, void(^block)(ASDisplayNode *node));
@interface ASDisplayNode (Yoga) @interface ASDisplayNode (Yoga)

View File

@@ -110,7 +110,7 @@ typedef NS_ENUM(NSInteger, ASCornerRoundingType) {
/** /**
* Default drawing priority for display node * Default drawing priority for display node
*/ */
extern NSInteger const ASDefaultDrawingPriority; AS_EXTERN NSInteger const ASDefaultDrawingPriority;
/** /**
* An `ASDisplayNode` is an abstraction over `UIView` and `CALayer` that allows you to perform calculations about a view * An `ASDisplayNode` is an abstraction over `UIView` and `CALayer` that allows you to perform calculations about a view

View File

@@ -36,10 +36,8 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
ASDISPLAYNODE_EXTERN_C_BEGIN
/// For deallocation of objects on the main thread across multiple run loops. /// For deallocation of objects on the main thread across multiple run loops.
extern void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull objectPtr); AS_EXTERN void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull objectPtr);
// Because inline methods can't be extern'd and need to be part of the translation unit of code // Because inline methods can't be extern'd and need to be part of the translation unit of code
// that compiles with them to actually inline, we both declare and define these in the header. // that compiles with them to actually inline, we both declare and define these in the header.
@@ -111,22 +109,22 @@ __unused static NSString *NSStringFromASInterfaceStateChange(ASInterfaceState ol
/** /**
Returns the appropriate interface state for a given ASDisplayNode and window Returns the appropriate interface state for a given ASDisplayNode and window
*/ */
extern ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWindow *window) AS_WARN_UNUSED_RESULT; AS_EXTERN ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWindow *window) AS_WARN_UNUSED_RESULT;
/** /**
Given a layer, returns the associated display node, if any. Given a layer, returns the associated display node, if any.
*/ */
extern ASDisplayNode * _Nullable ASLayerToDisplayNode(CALayer * _Nullable layer) AS_WARN_UNUSED_RESULT; AS_EXTERN ASDisplayNode * _Nullable ASLayerToDisplayNode(CALayer * _Nullable layer) AS_WARN_UNUSED_RESULT;
/** /**
Given a view, returns the associated display node, if any. Given a view, returns the associated display node, if any.
*/ */
extern ASDisplayNode * _Nullable ASViewToDisplayNode(UIView * _Nullable view) AS_WARN_UNUSED_RESULT; AS_EXTERN ASDisplayNode * _Nullable ASViewToDisplayNode(UIView * _Nullable view) AS_WARN_UNUSED_RESULT;
/** /**
Given a node, returns the root of the node hierarchy (where supernode == nil) Given a node, returns the root of the node hierarchy (where supernode == nil)
*/ */
extern ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) AS_WARN_UNUSED_RESULT; AS_EXTERN ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) AS_WARN_UNUSED_RESULT;
/** /**
If traverseSublayers == YES, this function will walk the layer hierarchy, spanning discontinuous sections of the node hierarchy\ If traverseSublayers == YES, this function will walk the layer hierarchy, spanning discontinuous sections of the node hierarchy\
@@ -134,39 +132,39 @@ extern ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) AS_
In the event that a node's backing layer is not created yet, the function will only walk the direct subnodes instead In the event that a node's backing layer is not created yet, the function will only walk the direct subnodes instead
of forcing the layer hierarchy to be created. of forcing the layer hierarchy to be created.
*/ */
extern void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)); AS_EXTERN void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node));
/** /**
This function will walk the node hierarchy in a breadth first fashion. It does run the block on the node provided This function will walk the node hierarchy in a breadth first fashion. It does run the block on the node provided
directly to the function call. It does NOT traverse sublayers. directly to the function call. It does NOT traverse sublayers.
*/ */
extern void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^block)(ASDisplayNode *node)); AS_EXTERN void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^block)(ASDisplayNode *node));
/** /**
Identical to ASDisplayNodePerformBlockOnEveryNode, except it does not run the block on the Identical to ASDisplayNodePerformBlockOnEveryNode, except it does not run the block on the
node provided directly to the function call - only on all descendants. node provided directly to the function call - only on all descendants.
*/ */
extern void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)); AS_EXTERN void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node));
/** /**
Given a display node, traverses up the layer tree hierarchy, returning the first display node that passes block. Given a display node, traverses up the layer tree hierarchy, returning the first display node that passes block.
*/ */
extern ASDisplayNode * _Nullable ASDisplayNodeFindFirstSupernode(ASDisplayNode * _Nullable node, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use the `supernodes` property instead."); AS_EXTERN ASDisplayNode * _Nullable ASDisplayNodeFindFirstSupernode(ASDisplayNode * _Nullable node, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use the `supernodes` property instead.");
/** /**
Given a display node, traverses up the layer tree hierarchy, returning the first display node of kind class. Given a display node, traverses up the layer tree hierarchy, returning the first display node of kind class.
*/ */
extern __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSupernodeOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use the `supernodeOfClass:includingSelf:` method instead."); AS_EXTERN __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSupernodeOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT ASDISPLAYNODE_DEPRECATED_MSG("Use the `supernodeOfClass:includingSelf:` method instead.");
/** /**
* Given a layer, find the window it lives in, if any. * Given a layer, find the window it lives in, if any.
*/ */
extern UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer) AS_WARN_UNUSED_RESULT; AS_EXTERN UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer) AS_WARN_UNUSED_RESULT;
/** /**
* Given a layer, find the closest view it lives in, if any. * Given a layer, find the closest view it lives in, if any.
*/ */
extern UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) AS_WARN_UNUSED_RESULT; AS_EXTERN UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) AS_WARN_UNUSED_RESULT;
/** /**
* Given two nodes, finds their most immediate common parent. Used for geometry conversion methods. * Given two nodes, finds their most immediate common parent. Used for geometry conversion methods.
@@ -176,50 +174,48 @@ extern UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) AS_WARN_UNUSE
* undefined and undocumented behavior of UIKit in ASDisplayNode, this operation is defined to be incorrect in all * undefined and undocumented behavior of UIKit in ASDisplayNode, this operation is defined to be incorrect in all
* circumstances and must be fixed wherever encountered. * circumstances and must be fixed wherever encountered.
*/ */
extern ASDisplayNode * _Nullable ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2) AS_WARN_UNUSED_RESULT; AS_EXTERN ASDisplayNode * _Nullable ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2) AS_WARN_UNUSED_RESULT;
/** /**
Given a display node, collects all descendants. This is a specialization of ASCollectContainer() that walks the Core Animation layer tree as opposed to the display node tree, thus supporting non-continues display node hierarchies. Given a display node, collects all descendants. This is a specialization of ASCollectContainer() that walks the Core Animation layer tree as opposed to the display node tree, thus supporting non-continues display node hierarchies.
*/ */
extern NSArray<ASDisplayNode *> *ASCollectDisplayNodes(ASDisplayNode *node) AS_WARN_UNUSED_RESULT; AS_EXTERN NSArray<ASDisplayNode *> *ASCollectDisplayNodes(ASDisplayNode *node) AS_WARN_UNUSED_RESULT;
/** /**
Given a display node, traverses down the node hierarchy, returning all the display nodes that pass the block. Given a display node, traverses down the node hierarchy, returning all the display nodes that pass the block.
*/ */
extern NSArray<ASDisplayNode *> *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; AS_EXTERN NSArray<ASDisplayNode *> *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT;
/** /**
Given a display node, traverses down the node hierarchy, returning all the display nodes of kind class. Given a display node, traverses down the node hierarchy, returning all the display nodes of kind class.
*/ */
extern NSArray<__kindof ASDisplayNode *> *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT; AS_EXTERN NSArray<__kindof ASDisplayNode *> *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT;
/** /**
Given a display node, traverses down the node hierarchy, returning the depth-first display node, including the start node that pass the block. Given a display node, traverses down the node hierarchy, returning the depth-first display node, including the start node that pass the block.
*/ */
extern __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstNode(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; AS_EXTERN __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstNode(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT;
/** /**
Given a display node, traverses down the node hierarchy, returning the depth-first display node, excluding the start node, that pass the block Given a display node, traverses down the node hierarchy, returning the depth-first display node, excluding the start node, that pass the block
*/ */
extern __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSubnode(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT; AS_EXTERN __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSubnode(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) AS_WARN_UNUSED_RESULT;
/** /**
Given a display node, traverses down the node hierarchy, returning the depth-first display node of kind class. Given a display node, traverses down the node hierarchy, returning the depth-first display node of kind class.
*/ */
extern __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT; AS_EXTERN __kindof ASDisplayNode * _Nullable ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) AS_WARN_UNUSED_RESULT;
extern UIColor *ASDisplayNodeDefaultPlaceholderColor(void) AS_WARN_UNUSED_RESULT; AS_EXTERN UIColor *ASDisplayNodeDefaultPlaceholderColor(void) AS_WARN_UNUSED_RESULT;
extern UIColor *ASDisplayNodeDefaultTintColor(void) AS_WARN_UNUSED_RESULT; AS_EXTERN UIColor *ASDisplayNodeDefaultTintColor(void) AS_WARN_UNUSED_RESULT;
/** /**
Disable willAppear / didAppear / didDisappear notifications for a sub-hierarchy, then re-enable when done. Nested calls are supported. Disable willAppear / didAppear / didDisappear notifications for a sub-hierarchy, then re-enable when done. Nested calls are supported.
*/ */
extern void ASDisplayNodeDisableHierarchyNotifications(ASDisplayNode *node); AS_EXTERN void ASDisplayNodeDisableHierarchyNotifications(ASDisplayNode *node);
extern void ASDisplayNodeEnableHierarchyNotifications(ASDisplayNode *node); AS_EXTERN void ASDisplayNodeEnableHierarchyNotifications(ASDisplayNode *node);
// Not to be called directly. // Not to be called directly.
extern void _ASSetDebugNames(Class owningClass, NSString *names, ASDisplayNode *object, ...); AS_EXTERN void _ASSetDebugNames(Class owningClass, NSString *names, ASDisplayNode *object, ...);
ASDISPLAYNODE_EXTERN_C_END
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -23,7 +23,7 @@
#import <queue> #import <queue>
#import <AsyncDisplayKit/ASRunLoopQueue.h> #import <AsyncDisplayKit/ASRunLoopQueue.h>
extern void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull objectPtr) { void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull objectPtr) {
/** /**
* UIKit components must be deallocated on the main thread. We use this shared * UIKit components must be deallocated on the main thread. We use this shared
* run loop queue to gradually deallocate them across many turns of the main run loop. * run loop queue to gradually deallocate them across many turns of the main run loop.
@@ -48,7 +48,7 @@ extern void ASPerformMainThreadDeallocation(id _Nullable __strong * _Nonnull obj
} }
} }
extern void _ASSetDebugNames(Class _Nonnull owningClass, NSString * _Nonnull names, ASDisplayNode * _Nullable object, ...) void _ASSetDebugNames(Class _Nonnull owningClass, NSString * _Nonnull names, ASDisplayNode * _Nullable object, ...)
{ {
NSString *owningClassName = NSStringFromClass(owningClass); NSString *owningClassName = NSStringFromClass(owningClass);
NSArray *nameArray = [names componentsSeparatedByString:@", "]; NSArray *nameArray = [names componentsSeparatedByString:@", "];
@@ -66,7 +66,7 @@ extern void _ASSetDebugNames(Class _Nonnull owningClass, NSString * _Nonnull nam
va_end(args); va_end(args);
} }
extern ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWindow *window) ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNode, UIWindow *window)
{ {
ASDisplayNodeCAssert(![displayNode isLayerBacked], @"displayNode must not be layer backed as it may have a nil window"); ASDisplayNodeCAssert(![displayNode isLayerBacked], @"displayNode must not be layer backed as it may have a nil window");
if (displayNode && [displayNode supportsRangeManagedInterfaceState]) { if (displayNode && [displayNode supportsRangeManagedInterfaceState]) {
@@ -81,17 +81,17 @@ extern ASInterfaceState ASInterfaceStateForDisplayNode(ASDisplayNode *displayNod
} }
} }
extern ASDisplayNode *ASLayerToDisplayNode(CALayer *layer) ASDisplayNode *ASLayerToDisplayNode(CALayer *layer)
{ {
return layer.asyncdisplaykit_node; return layer.asyncdisplaykit_node;
} }
extern ASDisplayNode *ASViewToDisplayNode(UIView *view) ASDisplayNode *ASViewToDisplayNode(UIView *view)
{ {
return view.asyncdisplaykit_node; return view.asyncdisplaykit_node;
} }
extern void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)) void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDisplayNode * _Nullable node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node))
{ {
if (!node) { if (!node) {
ASDisplayNodeCAssertNotNil(layer, @"Cannot recursively perform with nil node and nil layer"); ASDisplayNodeCAssertNotNil(layer, @"Cannot recursively perform with nil node and nil layer");
@@ -119,7 +119,7 @@ extern void ASDisplayNodePerformBlockOnEveryNode(CALayer * _Nullable layer, ASDi
} }
} }
extern void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^block)(ASDisplayNode *node)) void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^block)(ASDisplayNode *node))
{ {
// Queue used to keep track of subnodes while traversing this layout in a BFS fashion. // Queue used to keep track of subnodes while traversing this layout in a BFS fashion.
std::queue<ASDisplayNode *> queue; std::queue<ASDisplayNode *> queue;
@@ -138,7 +138,7 @@ extern void ASDisplayNodePerformBlockOnEveryNodeBFS(ASDisplayNode *node, void(^b
} }
} }
extern void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node)) void ASDisplayNodePerformBlockOnEverySubnode(ASDisplayNode *node, BOOL traverseSublayers, void(^block)(ASDisplayNode *node))
{ {
for (ASDisplayNode *subnode in node.subnodes) { for (ASDisplayNode *subnode in node.subnodes) {
ASDisplayNodePerformBlockOnEveryNode(nil, subnode, YES, block); ASDisplayNodePerformBlockOnEveryNode(nil, subnode, YES, block);
@@ -176,7 +176,7 @@ static void _ASCollectDisplayNodes(NSMutableArray *array, CALayer *layer)
_ASCollectDisplayNodes(array, sublayer); _ASCollectDisplayNodes(array, sublayer);
} }
extern NSArray<ASDisplayNode *> *ASCollectDisplayNodes(ASDisplayNode *node) NSArray<ASDisplayNode *> *ASCollectDisplayNodes(ASDisplayNode *node)
{ {
NSMutableArray *list = [[NSMutableArray alloc] init]; NSMutableArray *list = [[NSMutableArray alloc] init];
for (CALayer *sublayer in node.layer.sublayers) { for (CALayer *sublayer in node.layer.sublayers) {
@@ -201,14 +201,14 @@ static void _ASDisplayNodeFindAllSubnodes(NSMutableArray *array, ASDisplayNode *
} }
} }
extern NSArray<ASDisplayNode *> *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node)) NSArray<ASDisplayNode *> *ASDisplayNodeFindAllSubnodes(ASDisplayNode *start, BOOL (^block)(ASDisplayNode *node))
{ {
NSMutableArray *list = [[NSMutableArray alloc] init]; NSMutableArray *list = [[NSMutableArray alloc] init];
_ASDisplayNodeFindAllSubnodes(list, start, block); _ASDisplayNodeFindAllSubnodes(list, start, block);
return list; return list;
} }
extern NSArray<__kindof ASDisplayNode *> *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c) NSArray<__kindof ASDisplayNode *> *ASDisplayNodeFindAllSubnodesOfClass(ASDisplayNode *start, Class c)
{ {
return ASDisplayNodeFindAllSubnodes(start, ^(ASDisplayNode *n) { return ASDisplayNodeFindAllSubnodes(start, ^(ASDisplayNode *n) {
return [n isKindOfClass:c]; return [n isKindOfClass:c];
@@ -232,17 +232,17 @@ static ASDisplayNode *_ASDisplayNodeFindFirstNode(ASDisplayNode *startNode, BOOL
return nil; return nil;
} }
extern __kindof ASDisplayNode *ASDisplayNodeFindFirstNode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) __kindof ASDisplayNode *ASDisplayNodeFindFirstNode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node))
{ {
return _ASDisplayNodeFindFirstNode(startNode, YES, block); return _ASDisplayNodeFindFirstNode(startNode, YES, block);
} }
extern __kindof ASDisplayNode *ASDisplayNodeFindFirstSubnode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node)) __kindof ASDisplayNode *ASDisplayNodeFindFirstSubnode(ASDisplayNode *startNode, BOOL (^block)(ASDisplayNode *node))
{ {
return _ASDisplayNodeFindFirstNode(startNode, NO, block); return _ASDisplayNodeFindFirstNode(startNode, NO, block);
} }
extern __kindof ASDisplayNode *ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c) __kindof ASDisplayNode *ASDisplayNodeFindFirstSubnodeOfClass(ASDisplayNode *start, Class c)
{ {
return ASDisplayNodeFindFirstSubnode(start, ^(ASDisplayNode *n) { return ASDisplayNodeFindFirstSubnode(start, ^(ASDisplayNode *n) {
return [n isKindOfClass:c]; return [n isKindOfClass:c];
@@ -262,7 +262,7 @@ static inline BOOL _ASDisplayNodeIsAncestorOfDisplayNode(ASDisplayNode *possible
return NO; return NO;
} }
extern UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer) UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer)
{ {
UIView *view = ASFindClosestViewOfLayer(layer); UIView *view = ASFindClosestViewOfLayer(layer);
if (UIWindow *window = ASDynamicCast(view, UIWindow)) { if (UIWindow *window = ASDynamicCast(view, UIWindow)) {
@@ -272,7 +272,7 @@ extern UIWindow * _Nullable ASFindWindowOfLayer(CALayer *layer)
} }
} }
extern UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer) UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer)
{ {
while (layer != nil) { while (layer != nil) {
if (UIView *view = ASDynamicCast(layer.delegate, UIView)) { if (UIView *view = ASDynamicCast(layer.delegate, UIView)) {
@@ -283,7 +283,7 @@ extern UIView * _Nullable ASFindClosestViewOfLayer(CALayer *layer)
return nil; return nil;
} }
extern ASDisplayNode *ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2) ASDisplayNode *ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node1, ASDisplayNode *node2)
{ {
ASDisplayNode *possibleAncestor = node1; ASDisplayNode *possibleAncestor = node1;
while (possibleAncestor) { while (possibleAncestor) {
@@ -297,7 +297,7 @@ extern ASDisplayNode *ASDisplayNodeFindClosestCommonAncestor(ASDisplayNode *node
return possibleAncestor; return possibleAncestor;
} }
extern ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node) ASDisplayNode *ASDisplayNodeUltimateParentOfNode(ASDisplayNode *node)
{ {
// node <- supernode on each loop // node <- supernode on each loop
// previous <- node on each loop where node is not nil // previous <- node on each loop where node is not nil

View File

@@ -14,7 +14,6 @@
#import <AsyncDisplayKit/ASBaseDefines.h> #import <AsyncDisplayKit/ASBaseDefines.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
ASDISPLAYNODE_EXTERN_C_BEGIN
/** /**
* A bit mask of features. Make sure to update configuration.json when you add entries. * A bit mask of features. Make sure to update configuration.json when you add entries.
@@ -31,10 +30,9 @@ typedef NS_OPTIONS(NSUInteger, ASExperimentalFeatures) {
}; };
/// Convert flags -> name array. /// Convert flags -> name array.
NSArray<NSString *> *ASExperimentalFeaturesGetNames(ASExperimentalFeatures flags); AS_EXTERN NSArray<NSString *> *ASExperimentalFeaturesGetNames(ASExperimentalFeatures flags);
/// Convert name array -> flags. /// Convert name array -> flags.
ASExperimentalFeatures ASExperimentalFeaturesFromArray(NSArray<NSString *> *array); AS_EXTERN ASExperimentalFeatures ASExperimentalFeaturesFromArray(NSArray<NSString *> *array);
ASDISPLAYNODE_EXTERN_C_END
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -195,8 +195,6 @@ typedef UIImage * _Nullable (^asimagenode_modification_block_t)(UIImage *image);
@end @end
ASDISPLAYNODE_EXTERN_C_BEGIN
/** /**
* @abstract Image modification block that rounds (and optionally adds a border to) an image. * @abstract Image modification block that rounds (and optionally adds a border to) an image.
* *
@@ -207,7 +205,7 @@ ASDISPLAYNODE_EXTERN_C_BEGIN
* *
* @return An ASImageNode image modification block. * @return An ASImageNode image modification block.
*/ */
asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor * _Nullable borderColor); AS_EXTERN asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor * _Nullable borderColor);
/** /**
* @abstract Image modification block that applies a tint color à la UIImage configured with * @abstract Image modification block that applies a tint color à la UIImage configured with
@@ -219,7 +217,6 @@ asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat
* *
* @return An ASImageNode image modification block. * @return An ASImageNode image modification block.
*/ */
asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color); AS_EXTERN asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color);
ASDISPLAYNODE_EXTERN_C_END
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -732,7 +732,7 @@ static ASDN::StaticMutex& cacheLock = *new ASDN::StaticMutex;
#pragma mark - Extras #pragma mark - Extras
extern asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor *borderColor) asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(CGFloat borderWidth, UIColor *borderColor)
{ {
return ^(UIImage *originalImage) { return ^(UIImage *originalImage) {
ASGraphicsBeginImageContextWithOptions(originalImage.size, NO, originalImage.scale); ASGraphicsBeginImageContextWithOptions(originalImage.size, NO, originalImage.scale);
@@ -755,7 +755,7 @@ extern asimagenode_modification_block_t ASImageNodeRoundBorderModificationBlock(
}; };
} }
extern asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color) asimagenode_modification_block_t ASImageNodeTintColorModificationBlock(UIColor *color)
{ {
return ^(UIImage *originalImage) { return ^(UIImage *originalImage) {
ASGraphicsBeginImageContextWithOptions(originalImage.size, NO, originalImage.scale); ASGraphicsBeginImageContextWithOptions(originalImage.size, NO, originalImage.scale);

View File

@@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
typedef id<NSCopying, NSObject> ASImageIdentifier; typedef id<NSCopying, NSObject> ASImageIdentifier;
extern NSString *const ASMultiplexImageNodeErrorDomain; AS_EXTERN NSString *const ASMultiplexImageNodeErrorDomain;
/** /**
* ASMultiplexImageNode error codes. * ASMultiplexImageNode error codes.

View File

@@ -22,11 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
@class UIViewController; @class UIViewController;
ASDISPLAYNODE_EXTERN_C_BEGIN AS_EXTERN ASLayoutRangeMode ASLayoutRangeModeForVisibilityDepth(NSUInteger visibilityDepth);
extern ASLayoutRangeMode ASLayoutRangeModeForVisibilityDepth(NSUInteger visibilityDepth);
ASDISPLAYNODE_EXTERN_C_END
/** /**
* ASVisibilityDepth * ASVisibilityDepth

View File

@@ -81,13 +81,11 @@
*/ */
#pragma mark - Main Thread Assertions Disabling #pragma mark - Main Thread Assertions Disabling
ASDISPLAYNODE_EXTERN_C_BEGIN AS_EXTERN BOOL ASMainThreadAssertionsAreDisabled(void);
BOOL ASMainThreadAssertionsAreDisabled(void);
void ASPushMainThreadAssertionsDisabled(void); AS_EXTERN void ASPushMainThreadAssertionsDisabled(void);
void ASPopMainThreadAssertionsDisabled(void); AS_EXTERN void ASPopMainThreadAssertionsDisabled(void);
ASDISPLAYNODE_EXTERN_C_END
#pragma mark - Non-Fatal Assertions #pragma mark - Non-Fatal Assertions

View File

@@ -15,20 +15,9 @@
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// The C++ compiler mangles C function names. extern "C" { /* your C functions */ } prevents this. #import <Foundation/NSObjCRuntime.h>
// You should wrap all C function prototypes declared in headers with ASDISPLAYNODE_EXTERN_C_BEGIN/END, even if
// they are included only from .m (Objective-C) files. It's common for .m files to start using C++ #define AS_EXTERN FOUNDATION_EXTERN
// features and become .mm (Objective-C++) files. Always wrapping the prototypes with
// ASDISPLAYNODE_EXTERN_C_BEGIN/END will save someone a headache once they need to do this. You do not need to
// wrap constants, only C functions. See StackOverflow for more details:
// http://stackoverflow.com/questions/1041866/in-c-source-what-is-the-effect-of-extern-c
#ifdef __cplusplus
# define ASDISPLAYNODE_EXTERN_C_BEGIN extern "C" {
# define ASDISPLAYNODE_EXTERN_C_END }
#else
# define ASDISPLAYNODE_EXTERN_C_BEGIN
# define ASDISPLAYNODE_EXTERN_C_END
#endif
#ifdef __GNUC__ #ifdef __GNUC__
# define ASDISPLAYNODE_GNUC(major, minor) \ # define ASDISPLAYNODE_GNUC(major, minor) \

View File

@@ -25,8 +25,6 @@
#define ASEnableVerboseLogging 0 #define ASEnableVerboseLogging 0
#endif #endif
ASDISPLAYNODE_EXTERN_C_BEGIN
/** /**
* Disable all logging. * Disable all logging.
* *
@@ -40,7 +38,7 @@ ASDISPLAYNODE_EXTERN_C_BEGIN
* are at the `debug` log level, which the system * are at the `debug` log level, which the system
* disables in production. * disables in production.
*/ */
void ASDisableLogging(void); AS_EXTERN void ASDisableLogging(void);
/** /**
* Restore logging that has been runtime-disabled via ASDisableLogging(). * Restore logging that has been runtime-disabled via ASDisableLogging().
@@ -50,33 +48,31 @@ void ASDisableLogging(void);
* configuration. This can be used in conjunction with ASDisableLogging() * configuration. This can be used in conjunction with ASDisableLogging()
* to allow logging to be toggled off and back on at runtime. * to allow logging to be toggled off and back on at runtime.
*/ */
void ASEnableLogging(void); AS_EXTERN void ASEnableLogging(void);
/// Log for general node events e.g. interfaceState, didLoad. /// Log for general node events e.g. interfaceState, didLoad.
#define ASNodeLogEnabled 1 #define ASNodeLogEnabled 1
os_log_t ASNodeLog(void); AS_EXTERN os_log_t ASNodeLog(void);
/// Log for layout-specific events e.g. calculateLayout. /// Log for layout-specific events e.g. calculateLayout.
#define ASLayoutLogEnabled 1 #define ASLayoutLogEnabled 1
os_log_t ASLayoutLog(void); AS_EXTERN os_log_t ASLayoutLog(void);
/// Log for display-specific events e.g. display queue batches. /// Log for display-specific events e.g. display queue batches.
#define ASDisplayLogEnabled 1 #define ASDisplayLogEnabled 1
os_log_t ASDisplayLog(void); AS_EXTERN os_log_t ASDisplayLog(void);
/// Log for collection events e.g. reloadData, performBatchUpdates. /// Log for collection events e.g. reloadData, performBatchUpdates.
#define ASCollectionLogEnabled 1 #define ASCollectionLogEnabled 1
os_log_t ASCollectionLog(void); AS_EXTERN os_log_t ASCollectionLog(void);
/// Log for ASNetworkImageNode and ASMultiplexImageNode events. /// Log for ASNetworkImageNode and ASMultiplexImageNode events.
#define ASImageLoadingLogEnabled 1 #define ASImageLoadingLogEnabled 1
os_log_t ASImageLoadingLog(void); AS_EXTERN os_log_t ASImageLoadingLog(void);
/// Specialized log for our main thread deallocation trampoline. /// Specialized log for our main thread deallocation trampoline.
#define ASMainThreadDeallocationLogEnabled 0 #define ASMainThreadDeallocationLogEnabled 0
os_log_t ASMainThreadDeallocationLog(void); AS_EXTERN os_log_t ASMainThreadDeallocationLog(void);
ASDISPLAYNODE_EXTERN_C_END
/** /**
* The activity tracing system changed a lot between iOS 9 and 10. * The activity tracing system changed a lot between iOS 9 and 10.

View File

@@ -20,15 +20,11 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
ASDISPLAYNODE_EXTERN_C_BEGIN AS_EXTERN ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters);
FOUNDATION_EXPORT ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters); AS_EXTERN ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters);
FOUNDATION_EXPORT ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrollDirection scrollDirection, ASRangeTuningParameters rangeTuningParameters); AS_EXTERN CGRect CGRectExpandToRangeWithScrollableDirections(CGRect rect, ASRangeTuningParameters tuningParameters, ASScrollDirection scrollableDirections, ASScrollDirection scrollDirection);
FOUNDATION_EXPORT CGRect CGRectExpandToRangeWithScrollableDirections(CGRect rect, ASRangeTuningParameters tuningParameters, ASScrollDirection scrollableDirections, ASScrollDirection scrollDirection);
ASDISPLAYNODE_EXTERN_C_END
@interface ASAbstractLayoutController : NSObject <ASLayoutController> @interface ASAbstractLayoutController : NSObject <ASLayoutController>

View File

@@ -21,14 +21,14 @@
#include <vector> #include <vector>
extern ASRangeTuningParameters const ASRangeTuningParametersZero = {}; ASRangeTuningParameters const ASRangeTuningParametersZero = {};
extern BOOL ASRangeTuningParametersEqualToRangeTuningParameters(ASRangeTuningParameters lhs, ASRangeTuningParameters rhs) BOOL ASRangeTuningParametersEqualToRangeTuningParameters(ASRangeTuningParameters lhs, ASRangeTuningParameters rhs)
{ {
return lhs.leadingBufferScreenfuls == rhs.leadingBufferScreenfuls && lhs.trailingBufferScreenfuls == rhs.trailingBufferScreenfuls; return lhs.leadingBufferScreenfuls == rhs.leadingBufferScreenfuls && lhs.trailingBufferScreenfuls == rhs.trailingBufferScreenfuls;
} }
extern ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScrollDirection scrollDirection, ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScrollDirection scrollDirection,
ASRangeTuningParameters rangeTuningParameters) ASRangeTuningParameters rangeTuningParameters)
{ {
ASDirectionalScreenfulBuffer horizontalBuffer = {0, 0}; ASDirectionalScreenfulBuffer horizontalBuffer = {0, 0};
@@ -41,7 +41,7 @@ extern ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferHorizontal(ASScr
return horizontalBuffer; return horizontalBuffer;
} }
extern ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrollDirection scrollDirection, ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrollDirection scrollDirection,
ASRangeTuningParameters rangeTuningParameters) ASRangeTuningParameters rangeTuningParameters)
{ {
ASDirectionalScreenfulBuffer verticalBuffer = {0, 0}; ASDirectionalScreenfulBuffer verticalBuffer = {0, 0};
@@ -54,7 +54,7 @@ extern ASDirectionalScreenfulBuffer ASDirectionalScreenfulBufferVertical(ASScrol
return verticalBuffer; return verticalBuffer;
} }
extern CGRect CGRectExpandHorizontally(CGRect rect, ASDirectionalScreenfulBuffer buffer) CGRect CGRectExpandHorizontally(CGRect rect, ASDirectionalScreenfulBuffer buffer)
{ {
CGFloat negativeDirectionWidth = buffer.negativeDirection * rect.size.width; CGFloat negativeDirectionWidth = buffer.negativeDirection * rect.size.width;
CGFloat positiveDirectionWidth = buffer.positiveDirection * rect.size.width; CGFloat positiveDirectionWidth = buffer.positiveDirection * rect.size.width;
@@ -63,7 +63,7 @@ extern CGRect CGRectExpandHorizontally(CGRect rect, ASDirectionalScreenfulBuffer
return rect; return rect;
} }
extern CGRect CGRectExpandVertically(CGRect rect, ASDirectionalScreenfulBuffer buffer) CGRect CGRectExpandVertically(CGRect rect, ASDirectionalScreenfulBuffer buffer)
{ {
CGFloat negativeDirectionHeight = buffer.negativeDirection * rect.size.height; CGFloat negativeDirectionHeight = buffer.negativeDirection * rect.size.height;
CGFloat positiveDirectionHeight = buffer.positiveDirection * rect.size.height; CGFloat positiveDirectionHeight = buffer.positiveDirection * rect.size.height;
@@ -72,7 +72,7 @@ extern CGRect CGRectExpandVertically(CGRect rect, ASDirectionalScreenfulBuffer b
return rect; return rect;
} }
extern CGRect CGRectExpandToRangeWithScrollableDirections(CGRect rect, ASRangeTuningParameters tuningParameters, CGRect CGRectExpandToRangeWithScrollableDirections(CGRect rect, ASRangeTuningParameters tuningParameters,
ASScrollDirection scrollableDirections, ASScrollDirection scrollDirection) ASScrollDirection scrollableDirections, ASScrollDirection scrollDirection)
{ {
// Can scroll horizontally - expand the range appropriately // Can scroll horizontally - expand the range appropriately

View File

@@ -25,7 +25,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
extern ASSizeRange NodeConstrainedSizeForScrollDirection(ASCollectionView *collectionView); AS_EXTERN ASSizeRange NodeConstrainedSizeForScrollDirection(ASCollectionView *collectionView);
@protocol ASCollectionViewLayoutInspecting <NSObject> @protocol ASCollectionViewLayoutInspecting <NSObject>

View File

@@ -47,8 +47,8 @@ NS_ASSUME_NONNULL_BEGIN
typedef NSUInteger ASDataControllerAnimationOptions; typedef NSUInteger ASDataControllerAnimationOptions;
extern NSString * const ASDataControllerRowNodeKind; AS_EXTERN NSString * const ASDataControllerRowNodeKind;
extern NSString * const ASCollectionInvalidUpdateException; AS_EXTERN NSString * const ASCollectionInvalidUpdateException;
/** /**
Data source for data controller Data source for data controller

View File

@@ -29,28 +29,26 @@
*/ */
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
ASDISPLAYNODE_EXTERN_C_BEGIN
/** /**
* Creates a one-shot context. * Creates a one-shot context.
* *
* Behavior is the same as UIGraphicsBeginImageContextWithOptions. * Behavior is the same as UIGraphicsBeginImageContextWithOptions.
*/ */
extern void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale); AS_EXTERN void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale);
/** /**
* Generates and image and ends the current one-shot context. * Generates and image and ends the current one-shot context.
* *
* Behavior is the same as UIGraphicsGetImageFromCurrentImageContext followed by UIGraphicsEndImageContext. * Behavior is the same as UIGraphicsGetImageFromCurrentImageContext followed by UIGraphicsEndImageContext.
*/ */
extern UIImage * _Nullable ASGraphicsGetImageAndEndCurrentContext(void) NS_RETURNS_RETAINED; AS_EXTERN UIImage * _Nullable ASGraphicsGetImageAndEndCurrentContext(void) NS_RETURNS_RETAINED;
/** /**
* Call this if you want to end the current context without making an image. * Call this if you want to end the current context without making an image.
* *
* Behavior is the same as UIGraphicsEndImageContext. * Behavior is the same as UIGraphicsEndImageContext.
*/ */
extern void ASGraphicsEndImageContext(void); AS_EXTERN void ASGraphicsEndImageContext(void);
ASDISPLAYNODE_EXTERN_C_END
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -41,7 +41,7 @@ static UInt8 __contextDataAssociationKey;
#pragma mark - Graphics Contexts #pragma mark - Graphics Contexts
extern void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale) void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale)
{ {
if (!ASActivateExperimentalFeature(ASExperimentalGraphicsContexts)) { if (!ASActivateExperimentalFeature(ASExperimentalGraphicsContexts)) {
UIGraphicsBeginImageContextWithOptions(size, opaque, scale); UIGraphicsBeginImageContextWithOptions(size, opaque, scale);
@@ -106,7 +106,7 @@ extern void ASGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGF
CGContextRelease(context); CGContextRelease(context);
} }
extern UIImage * _Nullable ASGraphicsGetImageAndEndCurrentContext() NS_RETURNS_RETAINED UIImage * _Nullable ASGraphicsGetImageAndEndCurrentContext() NS_RETURNS_RETAINED
{ {
if (!ASActivateExperimentalFeature(ASExperimentalGraphicsContexts)) { if (!ASActivateExperimentalFeature(ASExperimentalGraphicsContexts)) {
UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
@@ -160,7 +160,7 @@ extern UIImage * _Nullable ASGraphicsGetImageAndEndCurrentContext() NS_RETURNS_R
return result; return result;
} }
extern void ASGraphicsEndImageContext() void ASGraphicsEndImageContext()
{ {
if (!ASActivateExperimentalFeature(ASExperimentalGraphicsContexts)) { if (!ASActivateExperimentalFeature(ASExperimentalGraphicsContexts)) {
UIGraphicsEndImageContext(); UIGraphicsEndImageContext();

View File

@@ -14,7 +14,6 @@
#import <AsyncDisplayKit/ASBaseDefines.h> #import <AsyncDisplayKit/ASBaseDefines.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
ASDISPLAYNODE_EXTERN_C_BEGIN
/** /**
* When std::hash is unavailable, this function will hash a bucket o' bits real fast. * When std::hash is unavailable, this function will hash a bucket o' bits real fast.
@@ -40,7 +39,6 @@ ASDISPLAYNODE_EXTERN_C_BEGIN
* use `pragma clang diagnostic warning "-Wpadded"` around your struct definition * use `pragma clang diagnostic warning "-Wpadded"` around your struct definition
* or manually initialize the fields of your struct (`myStruct.x = 7;` etc). * or manually initialize the fields of your struct (`myStruct.x = 7;` etc).
*/ */
NSUInteger ASHashBytes(void *bytes, size_t length); AS_EXTERN NSUInteger ASHashBytes(void *bytes, size_t length);
ASDISPLAYNODE_EXTERN_C_END
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -25,16 +25,12 @@ NS_ASSUME_NONNULL_BEGIN
@class ASCollectionElement, ASElementMap; @class ASCollectionElement, ASElementMap;
ASDISPLAYNODE_EXTERN_C_BEGIN
struct ASDirectionalScreenfulBuffer { struct ASDirectionalScreenfulBuffer {
CGFloat positiveDirection; // Positive relative to iOS Core Animation layer coordinate space. CGFloat positiveDirection; // Positive relative to iOS Core Animation layer coordinate space.
CGFloat negativeDirection; CGFloat negativeDirection;
}; };
typedef struct ASDirectionalScreenfulBuffer ASDirectionalScreenfulBuffer; typedef struct ASDirectionalScreenfulBuffer ASDirectionalScreenfulBuffer;
ASDISPLAYNODE_EXTERN_C_END
@protocol ASLayoutController <NSObject> @protocol ASLayoutController <NSObject>
- (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType; - (void)setTuningParameters:(ASRangeTuningParameters)tuningParameters forRangeMode:(ASLayoutRangeMode)rangeMode rangeType:(ASLayoutRangeType)rangeType;

View File

@@ -23,9 +23,9 @@ typedef struct {
CGFloat trailingBufferScreenfuls; CGFloat trailingBufferScreenfuls;
} ASRangeTuningParameters; } ASRangeTuningParameters;
FOUNDATION_EXPORT ASRangeTuningParameters const ASRangeTuningParametersZero; AS_EXTERN ASRangeTuningParameters const ASRangeTuningParametersZero;
FOUNDATION_EXPORT BOOL ASRangeTuningParametersEqualToRangeTuningParameters(ASRangeTuningParameters lhs, ASRangeTuningParameters rhs); AS_EXTERN BOOL ASRangeTuningParametersEqualToRangeTuningParameters(ASRangeTuningParameters lhs, ASRangeTuningParameters rhs);
/** /**
* Each mode has a complete set of tuning parameters for range types. * Each mode has a complete set of tuning parameters for range types.

View File

@@ -52,15 +52,13 @@ NS_ASSUME_NONNULL_BEGIN
- (NSMutableArray<NSDictionary *> *)propertiesForDescription; - (NSMutableArray<NSDictionary *> *)propertiesForDescription;
@end @end
ASDISPLAYNODE_EXTERN_C_BEGIN AS_EXTERN NSString *ASGetDescriptionValueString(id object);
NSString *ASGetDescriptionValueString(id object);
/// Useful for structs etc. Returns e.g. { position = (0 0); frame = (0 0; 50 50) } /// Useful for structs etc. Returns e.g. { position = (0 0); frame = (0 0; 50 50) }
NSString *ASObjectDescriptionMakeWithoutObject(NSArray<NSDictionary *> * _Nullable propertyGroups); AS_EXTERN NSString *ASObjectDescriptionMakeWithoutObject(NSArray<NSDictionary *> * _Nullable propertyGroups);
/// Returns e.g. <MYObject: 0xFFFFFFFF; name = "Object Name"; frame = (0 0; 50 50)> /// Returns e.g. <MYObject: 0xFFFFFFFF; name = "Object Name"; frame = (0 0; 50 50)>
NSString *ASObjectDescriptionMake(__autoreleasing id object, NSArray<NSDictionary *> * _Nullable propertyGroups); AS_EXTERN NSString *ASObjectDescriptionMake(__autoreleasing id object, NSArray<NSDictionary *> * _Nullable propertyGroups);
/** /**
* Returns e.g. <MYObject: 0xFFFFFFFF> * Returns e.g. <MYObject: 0xFFFFFFFF>
@@ -68,10 +66,8 @@ NSString *ASObjectDescriptionMake(__autoreleasing id object, NSArray<NSDictionar
* Note: `object` param is autoreleasing so that this function is dealloc-safe. * Note: `object` param is autoreleasing so that this function is dealloc-safe.
* No, unsafe_unretained isn't acceptable here the optimizer may deallocate object early. * No, unsafe_unretained isn't acceptable here the optimizer may deallocate object early.
*/ */
NSString *ASObjectDescriptionMakeTiny(__autoreleasing id _Nullable object); AS_EXTERN NSString *ASObjectDescriptionMakeTiny(__autoreleasing id _Nullable object);
NSString * _Nullable ASStringWithQuotesIfMultiword(NSString * _Nullable string); AS_EXTERN NSString * _Nullable ASStringWithQuotesIfMultiword(NSString * _Nullable string);
ASDISPLAYNODE_EXTERN_C_END
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -19,8 +19,6 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
ASDISPLAYNODE_EXTERN_C_BEGIN
/** /**
* Represents x and y coordinates of a page. * Represents x and y coordinates of a page.
*/ */
@@ -29,7 +27,7 @@ typedef uintptr_t ASPageCoordinate;
/** /**
* Returns a page coordinate with the given x and y values. Both of them must be less than 65,535. * Returns a page coordinate with the given x and y values. Both of them must be less than 65,535.
*/ */
extern ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y) AS_WARN_UNUSED_RESULT; AS_EXTERN ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y) AS_WARN_UNUSED_RESULT;
/** /**
* Returns coordinate of the page that contains the specified point. * Returns coordinate of the page that contains the specified point.
@@ -39,13 +37,13 @@ extern ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y) AS_WARN_UNU
* *
* @param pageSize The size of each page. * @param pageSize The size of each page.
*/ */
extern ASPageCoordinate ASPageCoordinateForPageThatContainsPoint(CGPoint point, CGSize pageSize) AS_WARN_UNUSED_RESULT; AS_EXTERN ASPageCoordinate ASPageCoordinateForPageThatContainsPoint(CGPoint point, CGSize pageSize) AS_WARN_UNUSED_RESULT;
extern uint16_t ASPageCoordinateGetX(ASPageCoordinate pageCoordinate) AS_WARN_UNUSED_RESULT; AS_EXTERN uint16_t ASPageCoordinateGetX(ASPageCoordinate pageCoordinate) AS_WARN_UNUSED_RESULT;
extern uint16_t ASPageCoordinateGetY(ASPageCoordinate pageCoordinate) AS_WARN_UNUSED_RESULT; AS_EXTERN uint16_t ASPageCoordinateGetY(ASPageCoordinate pageCoordinate) AS_WARN_UNUSED_RESULT;
extern CGRect ASPageCoordinateGetPageRect(ASPageCoordinate pageCoordinate, CGSize pageSize) AS_WARN_UNUSED_RESULT; AS_EXTERN CGRect ASPageCoordinateGetPageRect(ASPageCoordinate pageCoordinate, CGSize pageSize) AS_WARN_UNUSED_RESULT;
/** /**
* Returns coordinate pointers for pages that intersect the specified rect. For each pointer, use ASPageCoordinateFromPointer() to get the original coordinate. * Returns coordinate pointers for pages that intersect the specified rect. For each pointer, use ASPageCoordinateFromPointer() to get the original coordinate.
@@ -57,9 +55,7 @@ extern CGRect ASPageCoordinateGetPageRect(ASPageCoordinate pageCoordinate, CGSiz
* *
* @param pageSize The size of each page. * @param pageSize The size of each page.
*/ */
extern NSPointerArray * _Nullable ASPageCoordinatesForPagesThatIntersectRect(CGRect rect, CGSize contentSize, CGSize pageSize) AS_WARN_UNUSED_RESULT; AS_EXTERN NSPointerArray * _Nullable ASPageCoordinatesForPagesThatIntersectRect(CGRect rect, CGSize contentSize, CGSize pageSize) AS_WARN_UNUSED_RESULT;
ASDISPLAYNODE_EXTERN_C_END
/** /**
* An alias for an NSMapTable created to store objects using ASPageCoordinates as keys. * An alias for an NSMapTable created to store objects using ASPageCoordinates as keys.

View File

@@ -12,7 +12,7 @@
#import <AsyncDisplayKit/ASPageTable.h> #import <AsyncDisplayKit/ASPageTable.h>
extern ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y) ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y)
{ {
// Add 1 to the end result because 0 is not accepted by NSArray and NSMapTable. // Add 1 to the end result because 0 is not accepted by NSArray and NSMapTable.
// To avoid overflow after adding, x and y can't be UINT16_MAX (0xFFFF) **at the same time**. // To avoid overflow after adding, x and y can't be UINT16_MAX (0xFFFF) **at the same time**.
@@ -22,29 +22,29 @@ extern ASPageCoordinate ASPageCoordinateMake(uint16_t x, uint16_t y)
return (x << 16) + y + 1; return (x << 16) + y + 1;
} }
extern ASPageCoordinate ASPageCoordinateForPageThatContainsPoint(CGPoint point, CGSize pageSize) ASPageCoordinate ASPageCoordinateForPageThatContainsPoint(CGPoint point, CGSize pageSize)
{ {
return ASPageCoordinateMake((MAX(0.0, point.x) / pageSize.width), (MAX(0.0, point.y) / pageSize.height)); return ASPageCoordinateMake((MAX(0.0, point.x) / pageSize.width), (MAX(0.0, point.y) / pageSize.height));
} }
extern uint16_t ASPageCoordinateGetX(ASPageCoordinate pageCoordinate) uint16_t ASPageCoordinateGetX(ASPageCoordinate pageCoordinate)
{ {
return (pageCoordinate - 1) >> 16; return (pageCoordinate - 1) >> 16;
} }
extern uint16_t ASPageCoordinateGetY(ASPageCoordinate pageCoordinate) uint16_t ASPageCoordinateGetY(ASPageCoordinate pageCoordinate)
{ {
return (pageCoordinate - 1) & ~(0xFFFF<<16); return (pageCoordinate - 1) & ~(0xFFFF<<16);
} }
extern CGRect ASPageCoordinateGetPageRect(ASPageCoordinate pageCoordinate, CGSize pageSize) CGRect ASPageCoordinateGetPageRect(ASPageCoordinate pageCoordinate, CGSize pageSize)
{ {
CGFloat pageWidth = pageSize.width; CGFloat pageWidth = pageSize.width;
CGFloat pageHeight = pageSize.height; CGFloat pageHeight = pageSize.height;
return CGRectMake(ASPageCoordinateGetX(pageCoordinate) * pageWidth, ASPageCoordinateGetY(pageCoordinate) * pageHeight, pageWidth, pageHeight); return CGRectMake(ASPageCoordinateGetX(pageCoordinate) * pageWidth, ASPageCoordinateGetY(pageCoordinate) * pageHeight, pageWidth, pageHeight);
} }
extern NSPointerArray *ASPageCoordinatesForPagesThatIntersectRect(CGRect rect, CGSize contentSize, CGSize pageSize) NSPointerArray *ASPageCoordinatesForPagesThatIntersectRect(CGRect rect, CGSize contentSize, CGSize pageSize)
{ {
CGRect contentRect = CGRectMake(0.0, 0.0, contentSize.width, contentSize.height); CGRect contentRect = CGRectMake(0.0, 0.0, contentSize.width, contentSize.height);
// Make sure the specified rect is within contentRect // Make sure the specified rect is within contentRect

View File

@@ -17,10 +17,11 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <Photos/Photos.h> #import <Photos/Photos.h>
#import <AsyncDisplayKit/ASBaseDefines.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
extern NSString *const ASPhotosURLScheme; AS_EXTERN NSString *const ASPhotosURLScheme;
/** /**
@abstract Use ASPhotosFrameworkImageRequest to encapsulate all the information needed to request an image from @abstract Use ASPhotosFrameworkImageRequest to encapsulate all the information needed to request an image from

View File

@@ -11,6 +11,7 @@
// //
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <AsyncDisplayKit/ASBaseDefines.h>
#import <pthread/pthread.h> #import <pthread/pthread.h>
#import <os/lock.h> #import <os/lock.h>
@@ -32,18 +33,16 @@ typedef struct {
int _count; // Protected by lock int _count; // Protected by lock
} ASRecursiveUnfairLock; } ASRecursiveUnfairLock;
CF_EXTERN_C_BEGIN
/** /**
* Lock, blocking if needed. * Lock, blocking if needed.
*/ */
OS_UNFAIR_LOCK_AVAILABILITY AS_EXTERN OS_UNFAIR_LOCK_AVAILABILITY
void ASRecursiveUnfairLockLock(ASRecursiveUnfairLock *l); void ASRecursiveUnfairLockLock(ASRecursiveUnfairLock *l);
/** /**
* Try to lock without blocking. Returns whether we took the lock. * Try to lock without blocking. Returns whether we took the lock.
*/ */
OS_UNFAIR_LOCK_AVAILABILITY AS_EXTERN OS_UNFAIR_LOCK_AVAILABILITY
BOOL ASRecursiveUnfairLockTryLock(ASRecursiveUnfairLock *l); BOOL ASRecursiveUnfairLockTryLock(ASRecursiveUnfairLock *l);
/** /**
@@ -51,9 +50,7 @@ BOOL ASRecursiveUnfairLockTryLock(ASRecursiveUnfairLock *l);
* the lock will result in an assertion failure, and undefined * the lock will result in an assertion failure, and undefined
* behavior if foundation assertions are disabled. * behavior if foundation assertions are disabled.
*/ */
OS_UNFAIR_LOCK_AVAILABILITY AS_EXTERN OS_UNFAIR_LOCK_AVAILABILITY
void ASRecursiveUnfairLockUnlock(ASRecursiveUnfairLock *l); void ASRecursiveUnfairLockUnlock(ASRecursiveUnfairLock *l);
CF_EXTERN_C_END
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -30,20 +30,16 @@ typedef NS_OPTIONS(NSInteger, ASScrollDirection) {
ASScrollDirectionDown = 1 << 3 ASScrollDirectionDown = 1 << 3
}; };
extern const ASScrollDirection ASScrollDirectionHorizontalDirections; AS_EXTERN const ASScrollDirection ASScrollDirectionHorizontalDirections;
extern const ASScrollDirection ASScrollDirectionVerticalDirections; AS_EXTERN const ASScrollDirection ASScrollDirectionVerticalDirections;
ASDISPLAYNODE_EXTERN_C_BEGIN AS_EXTERN BOOL ASScrollDirectionContainsVerticalDirection(ASScrollDirection scrollDirection);
AS_EXTERN BOOL ASScrollDirectionContainsHorizontalDirection(ASScrollDirection scrollDirection);
BOOL ASScrollDirectionContainsVerticalDirection(ASScrollDirection scrollDirection); AS_EXTERN BOOL ASScrollDirectionContainsRight(ASScrollDirection scrollDirection);
BOOL ASScrollDirectionContainsHorizontalDirection(ASScrollDirection scrollDirection); AS_EXTERN BOOL ASScrollDirectionContainsLeft(ASScrollDirection scrollDirection);
AS_EXTERN BOOL ASScrollDirectionContainsUp(ASScrollDirection scrollDirection);
BOOL ASScrollDirectionContainsRight(ASScrollDirection scrollDirection); AS_EXTERN BOOL ASScrollDirectionContainsDown(ASScrollDirection scrollDirection);
BOOL ASScrollDirectionContainsLeft(ASScrollDirection scrollDirection); AS_EXTERN ASScrollDirection ASScrollDirectionApplyTransform(ASScrollDirection scrollDirection, CGAffineTransform transform);
BOOL ASScrollDirectionContainsUp(ASScrollDirection scrollDirection);
BOOL ASScrollDirectionContainsDown(ASScrollDirection scrollDirection);
ASScrollDirection ASScrollDirectionApplyTransform(ASScrollDirection scrollDirection, CGAffineTransform transform);
ASDISPLAYNODE_EXTERN_C_END
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -26,8 +26,6 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
ASDISPLAYNODE_EXTERN_C_BEGIN
#pragma mark - ASPrimitiveContentSizeCategory #pragma mark - ASPrimitiveContentSizeCategory
/** /**
@@ -54,7 +52,7 @@ typedef __unsafe_unretained UIContentSizeCategory ASPrimitiveContentSizeCategory
* *
* @return a pointer to one of the UIContentSizeCategory constants. * @return a pointer to one of the UIContentSizeCategory constants.
*/ */
extern ASPrimitiveContentSizeCategory ASPrimitiveContentSizeCategoryMake(UIContentSizeCategory sizeCategory); AS_EXTERN ASPrimitiveContentSizeCategory ASPrimitiveContentSizeCategoryMake(UIContentSizeCategory sizeCategory);
#pragma mark - ASPrimitiveTraitCollection #pragma mark - ASPrimitiveTraitCollection
@@ -88,31 +86,29 @@ typedef struct ASPrimitiveTraitCollection {
/** /**
* Creates ASPrimitiveTraitCollection with default values. * Creates ASPrimitiveTraitCollection with default values.
*/ */
extern ASPrimitiveTraitCollection ASPrimitiveTraitCollectionMakeDefault(void); AS_EXTERN ASPrimitiveTraitCollection ASPrimitiveTraitCollectionMakeDefault(void);
/** /**
* Creates a ASPrimitiveTraitCollection from a given UITraitCollection. * Creates a ASPrimitiveTraitCollection from a given UITraitCollection.
*/ */
extern ASPrimitiveTraitCollection ASPrimitiveTraitCollectionFromUITraitCollection(UITraitCollection *traitCollection); AS_EXTERN ASPrimitiveTraitCollection ASPrimitiveTraitCollectionFromUITraitCollection(UITraitCollection *traitCollection);
/** /**
* Compares two ASPrimitiveTraitCollection to determine if they are the same. * Compares two ASPrimitiveTraitCollection to determine if they are the same.
*/ */
extern BOOL ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(ASPrimitiveTraitCollection lhs, ASPrimitiveTraitCollection rhs); AS_EXTERN BOOL ASPrimitiveTraitCollectionIsEqualToASPrimitiveTraitCollection(ASPrimitiveTraitCollection lhs, ASPrimitiveTraitCollection rhs);
/** /**
* Returns a string representation of a ASPrimitiveTraitCollection. * Returns a string representation of a ASPrimitiveTraitCollection.
*/ */
extern NSString *NSStringFromASPrimitiveTraitCollection(ASPrimitiveTraitCollection traits); AS_EXTERN NSString *NSStringFromASPrimitiveTraitCollection(ASPrimitiveTraitCollection traits);
/** /**
* This function will walk the layout element hierarchy and updates the layout element trait collection for every * This function will walk the layout element hierarchy and updates the layout element trait collection for every
* layout element within the hierarchy. * layout element within the hierarchy.
*/ */
extern void ASTraitCollectionPropagateDown(id<ASLayoutElement> element, ASPrimitiveTraitCollection traitCollection); AS_EXTERN void ASTraitCollectionPropagateDown(id<ASLayoutElement> element, ASPrimitiveTraitCollection traitCollection);
ASDISPLAYNODE_EXTERN_C_END
/** /**
* Abstraction on top of UITraitCollection for propagation within AsyncDisplayKit-Layout * Abstraction on top of UITraitCollection for propagation within AsyncDisplayKit-Layout

View File

@@ -80,7 +80,7 @@ ASPrimitiveContentSizeCategory ASPrimitiveContentSizeCategoryMake(UIContentSizeC
#pragma mark - ASPrimitiveTraitCollection #pragma mark - ASPrimitiveTraitCollection
extern void ASTraitCollectionPropagateDown(id<ASLayoutElement> element, ASPrimitiveTraitCollection traitCollection) { void ASTraitCollectionPropagateDown(id<ASLayoutElement> element, ASPrimitiveTraitCollection traitCollection) {
if (element) { if (element) {
element.primitiveTraitCollection = traitCollection; element.primitiveTraitCollection = traitCollection;
} }

View File

@@ -33,8 +33,6 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
ASDISPLAYNODE_EXTERN_C_BEGIN
ASDISPLAYNODE_INLINE CGFloat ASCGFloatFromString(NSString *string) ASDISPLAYNODE_INLINE CGFloat ASCGFloatFromString(NSString *string)
{ {
#if CGFLOAT_IS_DOUBLE #if CGFLOAT_IS_DOUBLE
@@ -58,6 +56,4 @@ ASDISPLAYNODE_INLINE BOOL CGSizeEqualToSizeWithIn(CGSize size1, CGSize size2, CG
return fabs(size1.width - size2.width) < delta && fabs(size1.height - size2.height) < delta; return fabs(size1.width - size2.width) < delta && fabs(size1.height - size2.height) < delta;
}; };
ASDISPLAYNODE_EXTERN_C_END
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -16,6 +16,7 @@
// //
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <AsyncDisplayKit/ASBaseDefines.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@@ -39,7 +40,7 @@ typedef NS_ENUM(NSUInteger, ASAsyncTransactionState) {
ASAsyncTransactionStateComplete ASAsyncTransactionStateComplete
}; };
extern NSInteger const ASDefaultTransactionPriority; AS_EXTERN NSInteger const ASDefaultTransactionPriority;
/** /**
@summary ASAsyncTransaction provides lightweight transaction semantics for asynchronous operations. @summary ASAsyncTransaction provides lightweight transaction semantics for asynchronous operations.

View File

@@ -21,7 +21,6 @@
#import <AsyncDisplayKit/ASBaseDefines.h> #import <AsyncDisplayKit/ASBaseDefines.h>
#import <AsyncDisplayKit/ASAssert.h> #import <AsyncDisplayKit/ASAssert.h>
ASDISPLAYNODE_EXTERN_C_BEGIN
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
#pragma mark - #pragma mark -
@@ -90,7 +89,7 @@ typedef struct {
/** /**
* Represents auto as ASDimension * Represents auto as ASDimension
*/ */
extern ASDimension const ASDimensionAuto; AS_EXTERN ASDimension const ASDimensionAuto;
/** /**
* Returns a dimension with the specified type and value. * Returns a dimension with the specified type and value.
@@ -123,7 +122,7 @@ ASOVERLOADABLE ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASDimension ASDimensio
* Examples: ASDimensionMake(@"50%") = ASDimensionMake(ASDimensionUnitFraction, 0.5) * Examples: ASDimensionMake(@"50%") = ASDimensionMake(ASDimensionUnitFraction, 0.5)
* ASDimensionMake(@"0.5pt") = ASDimensionMake(ASDimensionUnitPoints, 0.5) * ASDimensionMake(@"0.5pt") = ASDimensionMake(ASDimensionUnitPoints, 0.5)
*/ */
ASOVERLOADABLE AS_WARN_UNUSED_RESULT extern ASDimension ASDimensionMake(NSString *dimension); ASOVERLOADABLE AS_WARN_UNUSED_RESULT AS_EXTERN ASDimension ASDimensionMake(NSString *dimension);
/** /**
* Returns a dimension with the specified points value. * Returns a dimension with the specified points value.
@@ -154,7 +153,7 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASDimensionEqualToDimension(ASDi
/** /**
* Returns a NSString representation of a dimension. * Returns a NSString representation of a dimension.
*/ */
extern AS_WARN_UNUSED_RESULT NSString *NSStringFromASDimension(ASDimension dimension); AS_EXTERN AS_WARN_UNUSED_RESULT NSString *NSStringFromASDimension(ASDimension dimension);
/** /**
* Resolve this dimension to a parent size. * Resolve this dimension to a parent size.
@@ -181,7 +180,7 @@ typedef struct {
ASDimension height; ASDimension height;
} ASLayoutSize; } ASLayoutSize;
extern ASLayoutSize const ASLayoutSizeAuto; AS_EXTERN ASLayoutSize const ASLayoutSizeAuto;
/* /*
* Creates an ASLayoutSize with provided min and max dimensions. * Creates an ASLayoutSize with provided min and max dimensions.
@@ -226,12 +225,12 @@ typedef struct {
/** /**
* A size range with all dimensions zero. * A size range with all dimensions zero.
*/ */
extern ASSizeRange const ASSizeRangeZero; AS_EXTERN ASSizeRange const ASSizeRangeZero;
/** /**
* A size range from zero to infinity in both directions. * A size range from zero to infinity in both directions.
*/ */
extern ASSizeRange const ASSizeRangeUnconstrained; AS_EXTERN ASSizeRange const ASSizeRangeUnconstrained;
/** /**
* Returns whether a size range has > 0.1 max width and max height. * Returns whether a size range has > 0.1 max width and max height.
@@ -282,7 +281,7 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT CGSize ASSizeRangeClamp(ASSizeRange s
* Intersects another size range. If the other size range does not overlap in either dimension, this size range * Intersects another size range. If the other size range does not overlap in either dimension, this size range
* "wins" by returning a single point within its own range that is closest to the non-overlapping range. * "wins" by returning a single point within its own range that is closest to the non-overlapping range.
*/ */
extern AS_WARN_UNUSED_RESULT ASSizeRange ASSizeRangeIntersect(ASSizeRange sizeRange, ASSizeRange otherSizeRange); AS_EXTERN AS_WARN_UNUSED_RESULT ASSizeRange ASSizeRangeIntersect(ASSizeRange sizeRange, ASSizeRange otherSizeRange);
/** /**
* Returns whether two size ranges are equal in min and max size. * Returns whether two size ranges are equal in min and max size.
@@ -295,7 +294,7 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASSizeRangeEqualToSizeRange(ASSi
/** /**
* Returns a string representation of a size range * Returns a string representation of a size range
*/ */
extern AS_WARN_UNUSED_RESULT NSString *NSStringFromASSizeRange(ASSizeRange sizeRange); AS_EXTERN AS_WARN_UNUSED_RESULT NSString *NSStringFromASSizeRange(ASSizeRange sizeRange);
#if YOGA #if YOGA
@@ -313,11 +312,10 @@ typedef struct {
ASDimension all; ASDimension all;
} ASEdgeInsets; } ASEdgeInsets;
extern ASEdgeInsets const ASEdgeInsetsZero; AS_EXTERN ASEdgeInsets const ASEdgeInsetsZero;
extern ASEdgeInsets ASEdgeInsetsMake(UIEdgeInsets edgeInsets); AS_EXTERN ASEdgeInsets ASEdgeInsetsMake(UIEdgeInsets edgeInsets);
#endif #endif
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
ASDISPLAYNODE_EXTERN_C_END

View File

@@ -121,7 +121,7 @@ NSString *NSStringFromASSizeRange(ASSizeRange sizeRange)
#pragma mark - Yoga - ASEdgeInsets #pragma mark - Yoga - ASEdgeInsets
ASEdgeInsets const ASEdgeInsetsZero = {}; ASEdgeInsets const ASEdgeInsetsZero = {};
extern ASEdgeInsets ASEdgeInsetsMake(UIEdgeInsets edgeInsets) ASEdgeInsets ASEdgeInsetsMake(UIEdgeInsets edgeInsets)
{ {
ASEdgeInsets asEdgeInsets = ASEdgeInsetsZero; ASEdgeInsets asEdgeInsets = ASEdgeInsetsZero;
asEdgeInsets.top = ASDimensionMake(edgeInsets.top); asEdgeInsets.top = ASDimensionMake(edgeInsets.top);

View File

@@ -15,11 +15,9 @@
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
#pragma once
#import <AsyncDisplayKit/ASBaseDefines.h> #import <AsyncDisplayKit/ASBaseDefines.h>
#import <AsyncDisplayKit/ASDimension.h> #import <AsyncDisplayKit/ASDimension.h>
ASDISPLAYNODE_EXTERN_C_BEGIN
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
#pragma mark - ASLayoutElementSize #pragma mark - ASLayoutElementSize
@@ -87,7 +85,7 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT BOOL ASLayoutElementSizeEqualToLayout
/** /**
* Returns a string formatted to contain the data from an ASLayoutElementSize. * Returns a string formatted to contain the data from an ASLayoutElementSize.
*/ */
extern AS_WARN_UNUSED_RESULT NSString *NSStringFromASLayoutElementSize(ASLayoutElementSize size); AS_EXTERN AS_WARN_UNUSED_RESULT NSString *NSStringFromASLayoutElementSize(ASLayoutElementSize size);
/** /**
* Resolve the given size relative to a parent size and an auto size. * Resolve the given size relative to a parent size and an auto size.
@@ -96,7 +94,7 @@ extern AS_WARN_UNUSED_RESULT NSString *NSStringFromASLayoutElementSize(ASLayoutE
* dimension with unit ASDimensionUnitAuto the given autoASSizeRange value will be used. * dimension with unit ASDimensionUnitAuto the given autoASSizeRange value will be used.
* Based on the calculated exact, min and max size constraints the final size range will be calculated. * Based on the calculated exact, min and max size constraints the final size range will be calculated.
*/ */
extern AS_WARN_UNUSED_RESULT ASSizeRange ASLayoutElementSizeResolveAutoSize(ASLayoutElementSize size, const CGSize parentSize, ASSizeRange autoASSizeRange); AS_EXTERN AS_WARN_UNUSED_RESULT ASSizeRange ASLayoutElementSizeResolveAutoSize(ASLayoutElementSize size, const CGSize parentSize, ASSizeRange autoASSizeRange);
/** /**
* Resolve the given size to a parent size. Uses internally ASLayoutElementSizeResolveAutoSize with {INFINITY, INFINITY} as * Resolve the given size to a parent size. Uses internally ASLayoutElementSizeResolveAutoSize with {INFINITY, INFINITY} as
@@ -109,4 +107,3 @@ ASDISPLAYNODE_INLINE AS_WARN_UNUSED_RESULT ASSizeRange ASLayoutElementSizeResolv
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
ASDISPLAYNODE_EXTERN_C_END

View File

@@ -22,18 +22,16 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
ASDISPLAYNODE_EXTERN_C_BEGIN AS_EXTERN CGPoint const ASPointNull; // {NAN, NAN}
extern CGPoint const ASPointNull; // {NAN, NAN} AS_EXTERN BOOL ASPointIsNull(CGPoint point);
extern BOOL ASPointIsNull(CGPoint point);
/** /**
* Safely calculates the layout of the given root layoutElement by guarding against nil nodes. * Safely calculates the layout of the given root layoutElement by guarding against nil nodes.
* @param rootLayoutElement The root node to calculate the layout for. * @param rootLayoutElement The root node to calculate the layout for.
* @param sizeRange The size range to calculate the root layout within. * @param sizeRange The size range to calculate the root layout within.
*/ */
extern ASLayout *ASCalculateRootLayout(id<ASLayoutElement> rootLayoutElement, const ASSizeRange sizeRange); AS_EXTERN ASLayout *ASCalculateRootLayout(id<ASLayoutElement> rootLayoutElement, const ASSizeRange sizeRange);
/** /**
* Safely computes the layout of the given node by guarding against nil nodes. * Safely computes the layout of the given node by guarding against nil nodes.
@@ -41,9 +39,7 @@ extern ASLayout *ASCalculateRootLayout(id<ASLayoutElement> rootLayoutElement, co
* @param sizeRange The size range to calculate the node layout within. * @param sizeRange The size range to calculate the node layout within.
* @param parentSize The parent size of the node to calculate the layout for. * @param parentSize The parent size of the node to calculate the layout for.
*/ */
extern ASLayout *ASCalculateLayout(id<ASLayoutElement>layoutElement, const ASSizeRange sizeRange, const CGSize parentSize); AS_EXTERN ASLayout *ASCalculateLayout(id<ASLayoutElement>layoutElement, const ASSizeRange sizeRange, const CGSize parentSize);
ASDISPLAYNODE_EXTERN_C_END
/** /**
* A node in the layout tree that represents the size and position of the object that created it (ASLayoutElement). * A node in the layout tree that represents the size and position of the object that created it (ASLayoutElement).

View File

@@ -30,7 +30,7 @@
CGPoint const ASPointNull = {NAN, NAN}; CGPoint const ASPointNull = {NAN, NAN};
extern BOOL ASPointIsNull(CGPoint point) BOOL ASPointIsNull(CGPoint point)
{ {
return isnan(point.x) && isnan(point.y); return isnan(point.x) && isnan(point.y);
} }

View File

@@ -33,10 +33,10 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
/** A constant that indicates that the parent's size is not yet determined in a given dimension. */ /** A constant that indicates that the parent's size is not yet determined in a given dimension. */
extern CGFloat const ASLayoutElementParentDimensionUndefined; AS_EXTERN CGFloat const ASLayoutElementParentDimensionUndefined;
/** A constant that indicates that the parent's size is not yet determined in either dimension. */ /** A constant that indicates that the parent's size is not yet determined in either dimension. */
extern CGSize const ASLayoutElementParentSizeUndefined; AS_EXTERN CGSize const ASLayoutElementParentSizeUndefined;
/** Type of ASLayoutElement */ /** Type of ASLayoutElement */
typedef NS_ENUM(NSUInteger, ASLayoutElementType) { typedef NS_ENUM(NSUInteger, ASLayoutElementType) {
@@ -152,24 +152,24 @@ typedef NS_ENUM(NSUInteger, ASLayoutElementType) {
#pragma mark - ASLayoutElementStyle #pragma mark - ASLayoutElementStyle
extern NSString * const ASLayoutElementStyleWidthProperty; AS_EXTERN NSString * const ASLayoutElementStyleWidthProperty;
extern NSString * const ASLayoutElementStyleMinWidthProperty; AS_EXTERN NSString * const ASLayoutElementStyleMinWidthProperty;
extern NSString * const ASLayoutElementStyleMaxWidthProperty; AS_EXTERN NSString * const ASLayoutElementStyleMaxWidthProperty;
extern NSString * const ASLayoutElementStyleHeightProperty; AS_EXTERN NSString * const ASLayoutElementStyleHeightProperty;
extern NSString * const ASLayoutElementStyleMinHeightProperty; AS_EXTERN NSString * const ASLayoutElementStyleMinHeightProperty;
extern NSString * const ASLayoutElementStyleMaxHeightProperty; AS_EXTERN NSString * const ASLayoutElementStyleMaxHeightProperty;
extern NSString * const ASLayoutElementStyleSpacingBeforeProperty; AS_EXTERN NSString * const ASLayoutElementStyleSpacingBeforeProperty;
extern NSString * const ASLayoutElementStyleSpacingAfterProperty; AS_EXTERN NSString * const ASLayoutElementStyleSpacingAfterProperty;
extern NSString * const ASLayoutElementStyleFlexGrowProperty; AS_EXTERN NSString * const ASLayoutElementStyleFlexGrowProperty;
extern NSString * const ASLayoutElementStyleFlexShrinkProperty; AS_EXTERN NSString * const ASLayoutElementStyleFlexShrinkProperty;
extern NSString * const ASLayoutElementStyleFlexBasisProperty; AS_EXTERN NSString * const ASLayoutElementStyleFlexBasisProperty;
extern NSString * const ASLayoutElementStyleAlignSelfProperty; AS_EXTERN NSString * const ASLayoutElementStyleAlignSelfProperty;
extern NSString * const ASLayoutElementStyleAscenderProperty; AS_EXTERN NSString * const ASLayoutElementStyleAscenderProperty;
extern NSString * const ASLayoutElementStyleDescenderProperty; AS_EXTERN NSString * const ASLayoutElementStyleDescenderProperty;
extern NSString * const ASLayoutElementStyleLayoutPositionProperty; AS_EXTERN NSString * const ASLayoutElementStyleLayoutPositionProperty;
@protocol ASLayoutElementStyleDelegate <NSObject> @protocol ASLayoutElementStyleDelegate <NSObject>
- (void)style:(__kindof ASLayoutElementStyle *)style propertyDidChange:(NSString *)propertyName; - (void)style:(__kindof ASLayoutElementStyle *)style propertyDidChange:(NSString *)propertyName;

View File

@@ -30,16 +30,16 @@ AS_SUBCLASSING_RESTRICTED
@property (nonatomic) int32_t transitionID; @property (nonatomic) int32_t transitionID;
@end @end
extern int32_t const ASLayoutElementContextInvalidTransitionID; AS_EXTERN int32_t const ASLayoutElementContextInvalidTransitionID;
extern int32_t const ASLayoutElementContextDefaultTransitionID; AS_EXTERN int32_t const ASLayoutElementContextDefaultTransitionID;
// Does not currently support nesting there must be no current context. // Does not currently support nesting there must be no current context.
extern void ASLayoutElementPushContext(ASLayoutElementContext * context); AS_EXTERN void ASLayoutElementPushContext(ASLayoutElementContext * context);
extern ASLayoutElementContext * _Nullable ASLayoutElementGetCurrentContext(void); AS_EXTERN ASLayoutElementContext * _Nullable ASLayoutElementGetCurrentContext(void);
extern void ASLayoutElementPopContext(void); AS_EXTERN void ASLayoutElementPopContext(void);
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -30,25 +30,23 @@
@end @end
extern void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode *node, void(^block)(ASDisplayNode *node)); AS_EXTERN void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode *node, void(^block)(ASDisplayNode *node));
ASDISPLAYNODE_EXTERN_C_BEGIN
#pragma mark - Yoga Type Conversion Helpers #pragma mark - Yoga Type Conversion Helpers
YGAlign yogaAlignItems(ASStackLayoutAlignItems alignItems); AS_EXTERN YGAlign yogaAlignItems(ASStackLayoutAlignItems alignItems);
YGJustify yogaJustifyContent(ASStackLayoutJustifyContent justifyContent); AS_EXTERN YGJustify yogaJustifyContent(ASStackLayoutJustifyContent justifyContent);
YGAlign yogaAlignSelf(ASStackLayoutAlignSelf alignSelf); AS_EXTERN YGAlign yogaAlignSelf(ASStackLayoutAlignSelf alignSelf);
YGFlexDirection yogaFlexDirection(ASStackLayoutDirection direction); AS_EXTERN YGFlexDirection yogaFlexDirection(ASStackLayoutDirection direction);
float yogaFloatForCGFloat(CGFloat value); AS_EXTERN float yogaFloatForCGFloat(CGFloat value);
float yogaDimensionToPoints(ASDimension dimension); AS_EXTERN float yogaDimensionToPoints(ASDimension dimension);
float yogaDimensionToPercent(ASDimension dimension); AS_EXTERN float yogaDimensionToPercent(ASDimension dimension);
ASDimension dimensionForEdgeWithEdgeInsets(YGEdge edge, ASEdgeInsets insets); AS_EXTERN ASDimension dimensionForEdgeWithEdgeInsets(YGEdge edge, ASEdgeInsets insets);
void ASLayoutElementYogaUpdateMeasureFunc(YGNodeRef yogaNode, id <ASLayoutElement> layoutElement); AS_EXTERN void ASLayoutElementYogaUpdateMeasureFunc(YGNodeRef yogaNode, id <ASLayoutElement> layoutElement);
YGSize ASLayoutElementYogaMeasureFunc(YGNodeRef yogaNode, AS_EXTERN YGSize ASLayoutElementYogaMeasureFunc(YGNodeRef yogaNode,
float width, YGMeasureMode widthMode, float width, YGMeasureMode widthMode,
float height, YGMeasureMode heightMode); float height, YGMeasureMode heightMode);
#pragma mark - Yoga Style Setter Helpers #pragma mark - Yoga Style Setter Helpers
@@ -79,6 +77,4 @@ YGSize ASLayoutElementYogaMeasureFunc(YGNodeRef yogaNode,
YGNodeStyleSet##property(yogaNode, edge, YGUndefined); \ YGNodeStyleSet##property(yogaNode, edge, YGUndefined); \
} \ } \
ASDISPLAYNODE_EXTERN_C_END
#endif /* YOGA */ #endif /* YOGA */

View File

@@ -47,7 +47,7 @@
@end @end
extern void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode *node, void(^block)(ASDisplayNode *node)) void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode *node, void(^block)(ASDisplayNode *node))
{ {
if (node == nil) { if (node == nil) {
return; return;

View File

@@ -19,8 +19,6 @@
#import <AsyncDisplayKit/ASScrollDirection.h> #import <AsyncDisplayKit/ASScrollDirection.h>
ASDISPLAYNODE_EXTERN_C_BEGIN
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@class ASBatchContext; @class ASBatchContext;
@@ -46,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
@param velocity The velocity of the scroll view (in points) at the moment the touch was released. @param velocity The velocity of the scroll view (in points) at the moment the touch was released.
@return Whether or not the current state should proceed with batch fetching. @return Whether or not the current state should proceed with batch fetching.
*/ */
BOOL ASDisplayShouldFetchBatchForScrollView(UIScrollView<ASBatchFetchingScrollView> *scrollView, AS_EXTERN BOOL ASDisplayShouldFetchBatchForScrollView(UIScrollView<ASBatchFetchingScrollView> *scrollView,
ASScrollDirection scrollDirection, ASScrollDirection scrollDirection,
ASScrollDirection scrollableDirections, ASScrollDirection scrollableDirections,
CGPoint contentOffset, CGPoint contentOffset,
@@ -69,7 +67,7 @@ BOOL ASDisplayShouldFetchBatchForScrollView(UIScrollView<ASBatchFetchingScrollVi
@discussion This method is broken into a category for unit testing purposes and should be used with the ASTableView and @discussion This method is broken into a category for unit testing purposes and should be used with the ASTableView and
* ASCollectionView batch fetching API. * ASCollectionView batch fetching API.
*/ */
extern BOOL ASDisplayShouldFetchBatchForContext(ASBatchContext *context, AS_EXTERN BOOL ASDisplayShouldFetchBatchForContext(ASBatchContext *context,
ASScrollDirection scrollDirection, ASScrollDirection scrollDirection,
ASScrollDirection scrollableDirections, ASScrollDirection scrollableDirections,
CGRect bounds, CGRect bounds,
@@ -81,4 +79,3 @@ extern BOOL ASDisplayShouldFetchBatchForContext(ASBatchContext *context,
_Nullable id<ASBatchFetchingDelegate> delegate); _Nullable id<ASBatchFetchingDelegate> delegate);
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
ASDISPLAYNODE_EXTERN_C_END

View File

@@ -18,10 +18,6 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
ASDISPLAYNODE_EXTERN_C_BEGIN AS_EXTERN ASSizeRange ASSizeRangeForCollectionLayoutThatFitsViewportSize(CGSize viewportSize, ASScrollDirection scrollableDirections) AS_WARN_UNUSED_RESULT;
FOUNDATION_EXPORT ASSizeRange ASSizeRangeForCollectionLayoutThatFitsViewportSize(CGSize viewportSize, ASScrollDirection scrollableDirections) AS_WARN_UNUSED_RESULT;
ASDISPLAYNODE_EXTERN_C_END
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -12,7 +12,7 @@
#import <AsyncDisplayKit/ASCollectionLayoutDefines.h> #import <AsyncDisplayKit/ASCollectionLayoutDefines.h>
extern ASSizeRange ASSizeRangeForCollectionLayoutThatFitsViewportSize(CGSize viewportSize, ASScrollDirection scrollableDirections) ASSizeRange ASSizeRangeForCollectionLayoutThatFitsViewportSize(CGSize viewportSize, ASScrollDirection scrollableDirections)
{ {
ASSizeRange sizeRange = ASSizeRangeUnconstrained; ASSizeRange sizeRange = ASSizeRangeUnconstrained;
if (ASScrollDirectionContainsVerticalDirection(scrollableDirections) == NO) { if (ASScrollDirectionContainsVerticalDirection(scrollableDirections) == NO) {

View File

@@ -18,15 +18,13 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <AsyncDisplayKit/ASBaseDefines.h> #import <AsyncDisplayKit/ASBaseDefines.h>
ASDISPLAYNODE_EXTERN_C_BEGIN
/** /**
* Like dispatch_apply, but you can set the thread count. 0 means 2*active CPUs. * Like dispatch_apply, but you can set the thread count. 0 means 2*active CPUs.
* *
* Note: The actual number of threads may be lower than threadCount, if libdispatch * Note: The actual number of threads may be lower than threadCount, if libdispatch
* decides the system can't handle it. In reality this rarely happens. * decides the system can't handle it. In reality this rarely happens.
*/ */
void ASDispatchApply(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, NS_NOESCAPE void(^work)(size_t i)); AS_EXTERN void ASDispatchApply(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, NS_NOESCAPE void(^work)(size_t i));
/** /**
* Like dispatch_async, but you can set the thread count. 0 means 2*active CPUs. * Like dispatch_async, but you can set the thread count. 0 means 2*active CPUs.
@@ -34,6 +32,4 @@ void ASDispatchApply(size_t iterationCount, dispatch_queue_t queue, NSUInteger t
* Note: The actual number of threads may be lower than threadCount, if libdispatch * Note: The actual number of threads may be lower than threadCount, if libdispatch
* decides the system can't handle it. In reality this rarely happens. * decides the system can't handle it. In reality this rarely happens.
*/ */
void ASDispatchAsync(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, NS_NOESCAPE void(^work)(size_t i)); AS_EXTERN void ASDispatchAsync(size_t iterationCount, dispatch_queue_t queue, NSUInteger threadCount, NS_NOESCAPE void(^work)(size_t i));
ASDISPLAYNODE_EXTERN_C_END

View File

@@ -65,8 +65,8 @@ typedef NS_OPTIONS(uint_least32_t, ASDisplayNodeAtomicFlags)
#define setFlag(flag, x) (((x ? _atomicFlags.fetch_or(flag) \ #define setFlag(flag, x) (((x ? _atomicFlags.fetch_or(flag) \
: _atomicFlags.fetch_and(~flag)) & flag) != 0) : _atomicFlags.fetch_and(~flag)) & flag) != 0)
FOUNDATION_EXPORT NSString * const ASRenderingEngineDidDisplayScheduledNodesNotification; AS_EXTERN NSString * const ASRenderingEngineDidDisplayScheduledNodesNotification;
FOUNDATION_EXPORT NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp; AS_EXTERN NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp;
// Allow 2^n increments of begin disabling hierarchy notifications // Allow 2^n increments of begin disabling hierarchy notifications
#define VISIBILITY_NOTIFICATIONS_DISABLED_BITS 4 #define VISIBILITY_NOTIFICATIONS_DISABLED_BITS 4

View File

@@ -17,7 +17,7 @@
#import <AsyncDisplayKit/ASThread.h> #import <AsyncDisplayKit/ASThread.h>
extern NSString *const ASAnimatedImageDefaultRunLoopMode; AS_EXTERN NSString *const ASAnimatedImageDefaultRunLoopMode;
@interface ASImageNode () @interface ASImageNode ()
{ {

View File

@@ -18,9 +18,6 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <AsyncDisplayKit/ASBaseDefines.h> #import <AsyncDisplayKit/ASBaseDefines.h>
ASDISPLAYNODE_EXTERN_C_BEGIN
/** /**
@abstract Decides how to scale and crop an image to fit in the provided size, while not wasting memory by upscaling images @abstract Decides how to scale and crop an image to fit in the provided size, while not wasting memory by upscaling images
@param sourceImageSize The size of the encoded image. @param sourceImageSize The size of the encoded image.
@@ -31,7 +28,7 @@ ASDISPLAYNODE_EXTERN_C_BEGIN
@param forcedSize A CGSize, that if non-CGSizeZero, indicates that the backing size should be forcedSize and not calculated based on boundsSize. @param forcedSize A CGSize, that if non-CGSizeZero, indicates that the backing size should be forcedSize and not calculated based on boundsSize.
@discussion If the image is smaller than the size and UIViewContentModeScaleToAspectFill is specified, we suggest the input size so it will be efficiently upscaled on the GPU by the displaying layer at composite time. @discussion If the image is smaller than the size and UIViewContentModeScaleToAspectFill is specified, we suggest the input size so it will be efficiently upscaled on the GPU by the displaying layer at composite time.
*/ */
extern void ASCroppedImageBackingSizeAndDrawRectInBounds(CGSize sourceImageSize, AS_EXTERN void ASCroppedImageBackingSizeAndDrawRectInBounds(CGSize sourceImageSize,
CGSize boundsSize, CGSize boundsSize,
UIViewContentMode contentMode, UIViewContentMode contentMode,
CGRect cropRect, CGRect cropRect,
@@ -40,5 +37,3 @@ extern void ASCroppedImageBackingSizeAndDrawRectInBounds(CGSize sourceImageSize,
CGSize *outBackingSize, CGSize *outBackingSize,
CGRect *outDrawRect CGRect *outDrawRect
); );
ASDISPLAYNODE_EXTERN_C_END

View File

@@ -23,45 +23,41 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
ASDISPLAYNODE_EXTERN_C_BEGIN AS_EXTERN void ASInitializeFrameworkMainThread(void);
void ASInitializeFrameworkMainThread(void); AS_EXTERN BOOL ASDefaultAllowsGroupOpacity(void);
AS_EXTERN BOOL ASDefaultAllowsEdgeAntialiasing(void);
BOOL ASDefaultAllowsGroupOpacity(void); AS_EXTERN BOOL ASSubclassOverridesSelector(Class superclass, Class subclass, SEL selector);
BOOL ASDefaultAllowsEdgeAntialiasing(void); AS_EXTERN BOOL ASSubclassOverridesClassSelector(Class superclass, Class subclass, SEL selector);
BOOL ASSubclassOverridesSelector(Class superclass, Class subclass, SEL selector);
BOOL ASSubclassOverridesClassSelector(Class superclass, Class subclass, SEL selector);
/// Replace a method from the given class with a block and returns the original method IMP /// Replace a method from the given class with a block and returns the original method IMP
IMP ASReplaceMethodWithBlock(Class c, SEL origSEL, id block); AS_EXTERN IMP ASReplaceMethodWithBlock(Class c, SEL origSEL, id block);
/// Dispatches the given block to the main queue if not already running on the main thread /// Dispatches the given block to the main queue if not already running on the main thread
void ASPerformBlockOnMainThread(void (^block)(void)); AS_EXTERN void ASPerformBlockOnMainThread(void (^block)(void));
/// Dispatches the given block to a background queue with priority of DISPATCH_QUEUE_PRIORITY_DEFAULT if not already run on a background queue /// Dispatches the given block to a background queue with priority of DISPATCH_QUEUE_PRIORITY_DEFAULT if not already run on a background queue
void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT AS_EXTERN void ASPerformBlockOnBackgroundThread(void (^block)(void)); // DISPATCH_QUEUE_PRIORITY_DEFAULT
/// For deallocation of objects on a background thread without GCD overhead / thread explosion /// For deallocation of objects on a background thread without GCD overhead / thread explosion
void ASPerformBackgroundDeallocation(id __strong _Nullable * _Nonnull object); AS_EXTERN void ASPerformBackgroundDeallocation(id __strong _Nullable * _Nonnull object);
CGFloat ASScreenScale(void); AS_EXTERN CGFloat ASScreenScale(void);
CGSize ASFloorSizeValues(CGSize s); AS_EXTERN CGSize ASFloorSizeValues(CGSize s);
CGFloat ASFloorPixelValue(CGFloat f); AS_EXTERN CGFloat ASFloorPixelValue(CGFloat f);
CGPoint ASCeilPointValues(CGPoint p); AS_EXTERN CGPoint ASCeilPointValues(CGPoint p);
CGSize ASCeilSizeValues(CGSize s); AS_EXTERN CGSize ASCeilSizeValues(CGSize s);
CGFloat ASCeilPixelValue(CGFloat f); AS_EXTERN CGFloat ASCeilPixelValue(CGFloat f);
CGFloat ASRoundPixelValue(CGFloat f); AS_EXTERN CGFloat ASRoundPixelValue(CGFloat f);
Class _Nullable ASGetClassFromType(const char * _Nullable type); AS_EXTERN Class _Nullable ASGetClassFromType(const char * _Nullable type);
ASDISPLAYNODE_EXTERN_C_END
ASDISPLAYNODE_INLINE BOOL ASImageAlphaInfoIsOpaque(CGImageAlphaInfo info) { ASDISPLAYNODE_INLINE BOOL ASImageAlphaInfoIsOpaque(CGImageAlphaInfo info) {
switch (info) { switch (info) {

View File

@@ -19,42 +19,36 @@
#import <AsyncDisplayKit/ASBaseDefines.h> #import <AsyncDisplayKit/ASBaseDefines.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
/** /**
* Helper class for operation on two-dimensional array, where the objects of the root array are each arrays * Helper functions for two-dimensional array, where the objects of the root array are each arrays.
*/ */
ASDISPLAYNODE_EXTERN_C_BEGIN
/** /**
* Deep mutable copy of an array that contains arrays, which contain objects. It will go one level deep into the array to copy. * Deep mutable copy of an array that contains arrays, which contain objects. It will go one level deep into the array to copy.
* This method is substantially faster than the generalized version, e.g. about 10x faster, so use it whenever it fits the need. * This method is substantially faster than the generalized version, e.g. about 10x faster, so use it whenever it fits the need.
*/ */
extern NSMutableArray<NSMutableArray *> *ASTwoDimensionalArrayDeepMutableCopy(NSArray<NSArray *> *array) AS_WARN_UNUSED_RESULT; AS_EXTERN NSMutableArray<NSMutableArray *> *ASTwoDimensionalArrayDeepMutableCopy(NSArray<NSArray *> *array) AS_WARN_UNUSED_RESULT;
/** /**
* Delete the elements of the mutable two-dimensional array at given index paths sorted in descending order! * Delete the elements of the mutable two-dimensional array at given index paths sorted in descending order!
*/ */
extern void ASDeleteElementsInTwoDimensionalArrayAtIndexPaths(NSMutableArray *mutableArray, NSArray<NSIndexPath *> *indexPaths); AS_EXTERN void ASDeleteElementsInTwoDimensionalArrayAtIndexPaths(NSMutableArray *mutableArray, NSArray<NSIndexPath *> *indexPaths);
/** /**
* Return all the index paths of a two-dimensional array, in ascending order. * Return all the index paths of a two-dimensional array, in ascending order.
*/ */
extern NSArray<NSIndexPath *> *ASIndexPathsForTwoDimensionalArray(NSArray<NSArray *>* twoDimensionalArray) AS_WARN_UNUSED_RESULT; AS_EXTERN NSArray<NSIndexPath *> *ASIndexPathsForTwoDimensionalArray(NSArray<NSArray *>* twoDimensionalArray) AS_WARN_UNUSED_RESULT;
/** /**
* Return all the elements of a two-dimensional array, in ascending order. * Return all the elements of a two-dimensional array, in ascending order.
*/ */
extern NSArray *ASElementsInTwoDimensionalArray(NSArray<NSArray *>* twoDimensionalArray) AS_WARN_UNUSED_RESULT; AS_EXTERN NSArray *ASElementsInTwoDimensionalArray(NSArray<NSArray *>* twoDimensionalArray) AS_WARN_UNUSED_RESULT;
/** /**
* Attempt to get the object at the given index path. Returns @c nil if the index path is out of bounds. * Attempt to get the object at the given index path. Returns @c nil if the index path is out of bounds.
*/ */
extern id _Nullable ASGetElementInTwoDimensionalArray(NSArray<NSArray *> *array, NSIndexPath *indexPath) AS_WARN_UNUSED_RESULT; AS_EXTERN id _Nullable ASGetElementInTwoDimensionalArray(NSArray<NSArray *> *array, NSIndexPath *indexPath) AS_WARN_UNUSED_RESULT;
ASDISPLAYNODE_EXTERN_C_END
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -22,7 +22,7 @@
#import <AsyncDisplayKit/ASStackLayoutSpec.h> #import <AsyncDisplayKit/ASStackLayoutSpec.h>
/** The threshold that determines if a violation has actually occurred. */ /** The threshold that determines if a violation has actually occurred. */
extern CGFloat const kViolationEpsilon; AS_EXTERN CGFloat const kViolationEpsilon;
struct ASStackLayoutSpecChild { struct ASStackLayoutSpecChild {
/** The original source child. */ /** The original source child. */

View File

@@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
/** /**
The max text container size in layout. The max text container size in layout.
*/ */
extern const CGSize ASTextContainerMaxSize; AS_EXTERN const CGSize ASTextContainerMaxSize;
/** /**
The ASTextContainer class defines a region in which text is laid out. The ASTextContainer class defines a region in which text is laid out.

View File

@@ -15,6 +15,7 @@
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
#import <AsyncDisplayKit/ASBaseDefines.h>
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@@ -30,7 +31,7 @@ typedef NS_OPTIONS(NSInteger, ASTextAttributeType) {
}; };
/// Get the attribute type from an attribute name. /// Get the attribute type from an attribute name.
extern ASTextAttributeType ASTextAttributeGetType(NSString *attributeName); AS_EXTERN ASTextAttributeType ASTextAttributeGetType(NSString *attributeName);
/** /**
Line style in ASText (similar to NSUnderlineStyle). Line style in ASText (similar to NSUnderlineStyle).

View File

@@ -20,8 +20,6 @@
#import <AsyncDisplayKit/ASBaseDefines.h> #import <AsyncDisplayKit/ASBaseDefines.h>
#import <AsyncDisplayKit/ASDisplayNode.h> #import <AsyncDisplayKit/ASDisplayNode.h>
ASDISPLAYNODE_EXTERN_C_BEGIN
// This protocol defines the core properties that ASDisplayNode and CALayer share, for managing contents. // This protocol defines the core properties that ASDisplayNode and CALayer share, for managing contents.
@protocol ASResizableContents @protocol ASResizableContents
@required @required
@@ -44,21 +42,21 @@ ASDISPLAYNODE_EXTERN_C_BEGIN
@param obj ASDisplayNode, CALayer or object that conforms to `ASResizableContents` protocol @param obj ASDisplayNode, CALayer or object that conforms to `ASResizableContents` protocol
@param image Image you would like to resize @param image Image you would like to resize
*/ */
extern void ASDisplayNodeSetResizableContents(id<ASResizableContents> obj, UIImage *image); AS_EXTERN void ASDisplayNodeSetResizableContents(id<ASResizableContents> obj, UIImage *image);
/** /**
Turns a value of UIViewContentMode to a string for debugging or serialization Turns a value of UIViewContentMode to a string for debugging or serialization
@param contentMode Any of the UIViewContentMode constants @param contentMode Any of the UIViewContentMode constants
@return A human-readable representation of the constant, or the integer value of the constant if not recognized. @return A human-readable representation of the constant, or the integer value of the constant if not recognized.
*/ */
extern NSString *ASDisplayNodeNSStringFromUIContentMode(UIViewContentMode contentMode); AS_EXTERN NSString *ASDisplayNodeNSStringFromUIContentMode(UIViewContentMode contentMode);
/** /**
Turns a string representing a contentMode into a contentMode Turns a string representing a contentMode into a contentMode
@param string Any of the strings in UIContentModeDescriptionLUT @param string Any of the strings in UIContentModeDescriptionLUT
@return Any of the UIViewContentMode constants, or an int if the string is a number. If the string is not recognized, UIViewContentModeScaleToFill is returned. @return Any of the UIViewContentMode constants, or an int if the string is a number. If the string is not recognized, UIViewContentModeScaleToFill is returned.
*/ */
extern UIViewContentMode ASDisplayNodeUIContentModeFromNSString(NSString *string); AS_EXTERN UIViewContentMode ASDisplayNodeUIContentModeFromNSString(NSString *string);
/** /**
Maps a value of UIViewContentMode to a corresponding contentsGravity Maps a value of UIViewContentMode to a corresponding contentsGravity
@@ -66,7 +64,7 @@ extern UIViewContentMode ASDisplayNodeUIContentModeFromNSString(NSString *string
@param contentMode A content mode except for UIViewContentModeRedraw, which has no corresponding contentsGravity (it corresponds to needsDisplayOnBoundsChange = YES) @param contentMode A content mode except for UIViewContentModeRedraw, which has no corresponding contentsGravity (it corresponds to needsDisplayOnBoundsChange = YES)
@return An NSString constant from the documentation, eg kCAGravityCenter... or nil if there is no corresponding contentsGravity. Will assert if contentMode is unknown. @return An NSString constant from the documentation, eg kCAGravityCenter... or nil if there is no corresponding contentsGravity. Will assert if contentMode is unknown.
*/ */
extern NSString *const ASDisplayNodeCAContentsGravityFromUIContentMode(UIViewContentMode contentMode); AS_EXTERN NSString *const ASDisplayNodeCAContentsGravityFromUIContentMode(UIViewContentMode contentMode);
/** /**
Maps a value of contentsGravity to a corresponding UIViewContentMode Maps a value of contentsGravity to a corresponding UIViewContentMode
@@ -74,23 +72,21 @@ extern NSString *const ASDisplayNodeCAContentsGravityFromUIContentMode(UIViewCon
@param contentsGravity A contents gravity @param contentsGravity A contents gravity
@return A UIViewContentMode constant from UIView.h, eg UIViewContentModeCenter..., or UIViewContentModeScaleToFill if contentsGravity is not one of the CA constants. Will assert if the contentsGravity is unknown. @return A UIViewContentMode constant from UIView.h, eg UIViewContentModeCenter..., or UIViewContentModeScaleToFill if contentsGravity is not one of the CA constants. Will assert if the contentsGravity is unknown.
*/ */
extern UIViewContentMode ASDisplayNodeUIContentModeFromCAContentsGravity(NSString *const contentsGravity); AS_EXTERN UIViewContentMode ASDisplayNodeUIContentModeFromCAContentsGravity(NSString *const contentsGravity);
/** /**
Use this to create a stretchable appropriate to approximate a filled rectangle, but with antialiasing on the edges when not pixel-aligned. It's best to keep the layer this image is added to with contentsScale equal to the scale of the final transform to screen space so it is able to antialias appropriately even when you shrink or grow the layer. Use this to create a stretchable appropriate to approximate a filled rectangle, but with antialiasing on the edges when not pixel-aligned. It's best to keep the layer this image is added to with contentsScale equal to the scale of the final transform to screen space so it is able to antialias appropriately even when you shrink or grow the layer.
@param color the fill color to use in the center of the image @param color the fill color to use in the center of the image
@param innerSize Unfortunately, 4 seems to be the smallest inner size that works if you're applying this stretchable to a larger box, whereas it does not display correctly for larger boxes. Thus some adjustment is necessary for the size of box you're displaying. If you're showing a 1px horizontal line, pass 1 height and at least 4 width. 2px vertical line: 2px wide, 4px high. Passing an innerSize greater that you desire is wasteful @param innerSize Unfortunately, 4 seems to be the smallest inner size that works if you're applying this stretchable to a larger box, whereas it does not display correctly for larger boxes. Thus some adjustment is necessary for the size of box you're displaying. If you're showing a 1px horizontal line, pass 1 height and at least 4 width. 2px vertical line: 2px wide, 4px high. Passing an innerSize greater that you desire is wasteful
*/ */
extern UIImage *ASDisplayNodeStretchableBoxContentsWithColor(UIColor *color, CGSize innerSize); AS_EXTERN UIImage *ASDisplayNodeStretchableBoxContentsWithColor(UIColor *color, CGSize innerSize);
/** /**
Checks whether a layer has ongoing animations Checks whether a layer has ongoing animations
@param layer A layer to check if animations are ongoing @param layer A layer to check if animations are ongoing
@return YES if the layer has ongoing animations, otherwise NO @return YES if the layer has ongoing animations, otherwise NO
*/ */
extern BOOL ASDisplayNodeLayerHasAnimations(CALayer *layer); AS_EXTERN BOOL ASDisplayNodeLayerHasAnimations(CALayer *layer);
// This function is a less generalized version of ASDisplayNodeSetResizableContents. // This function is a less generalized version of ASDisplayNodeSetResizableContents.
extern void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage *image) ASDISPLAYNODE_DEPRECATED; AS_EXTERN void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage *image) ASDISPLAYNODE_DEPRECATED;
ASDISPLAYNODE_EXTERN_C_END

View File

@@ -19,12 +19,12 @@
#import <AsyncDisplayKit/ASEqualityHelpers.h> #import <AsyncDisplayKit/ASEqualityHelpers.h>
#import <AsyncDisplayKit/ASAssert.h> #import <AsyncDisplayKit/ASAssert.h>
extern void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage *image) void ASDisplayNodeSetupLayerContentsWithResizableImage(CALayer *layer, UIImage *image)
{ {
ASDisplayNodeSetResizableContents(layer, image); ASDisplayNodeSetResizableContents(layer, image);
} }
extern void ASDisplayNodeSetResizableContents(id<ASResizableContents> obj, UIImage *image) void ASDisplayNodeSetResizableContents(id<ASResizableContents> obj, UIImage *image)
{ {
if (image) { if (image) {
ASDisplayNodeCAssert(image.resizingMode == UIImageResizingModeStretch || UIEdgeInsetsEqualToEdgeInsets(image.capInsets, UIEdgeInsetsZero), ASDisplayNodeCAssert(image.resizingMode == UIImageResizingModeStretch || UIEdgeInsetsEqualToEdgeInsets(image.capInsets, UIEdgeInsetsZero),

View File

@@ -20,12 +20,12 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <AsyncDisplayKit/ASEqualityHelpers.h> #import <AsyncDisplayKit/ASEqualityHelpers.h>
extern NSString *const ASTextKitTruncationAttributeName; AS_EXTERN NSString *const ASTextKitTruncationAttributeName;
/** /**
Use ASTextKitEntityAttribute as the value of this attribute to embed a link or other interactable content inside the Use ASTextKitEntityAttribute as the value of this attribute to embed a link or other interactable content inside the
text. text.
*/ */
extern NSString *const ASTextKitEntityAttributeName; AS_EXTERN NSString *const ASTextKitEntityAttributeName;
/** /**
All NSObject values in this struct should be copied when passed into the TextComponent. All NSObject values in this struct should be copied when passed into the TextComponent.

View File

@@ -22,7 +22,6 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
ASDISPLAYNODE_EXTERN_C_BEGIN
/** /**
@abstract Returns whether a given attribute is an unsupported Core Text attribute. @abstract Returns whether a given attribute is an unsupported Core Text attribute.
@param attributeName The name of the attribute @param attributeName The name of the attribute
@@ -40,7 +39,7 @@ ASDISPLAYNODE_EXTERN_C_BEGIN
- kCTUnderlineColorAttributeName - kCTUnderlineColorAttributeName
@result Whether attributeName is an unsupported Core Text attribute. @result Whether attributeName is an unsupported Core Text attribute.
*/ */
BOOL ASAttributeWithNameIsUnsupportedCoreTextAttribute(NSString *attributeName); AS_EXTERN BOOL ASAttributeWithNameIsUnsupportedCoreTextAttribute(NSString *attributeName);
/** /**
@@ -60,16 +59,14 @@ BOOL ASAttributeWithNameIsUnsupportedCoreTextAttribute(NSString *attributeName);
- kCTUnderlineColorAttributeName - kCTUnderlineColorAttributeName
@result An NSDictionary of attributes for use by NSAttributedString. @result An NSDictionary of attributes for use by NSAttributedString.
*/ */
extern NSDictionary *NSAttributedStringAttributesForCoreTextAttributes(NSDictionary *coreTextAttributes); AS_EXTERN NSDictionary *NSAttributedStringAttributesForCoreTextAttributes(NSDictionary *coreTextAttributes);
/** /**
@abstract Returns an NSAttributedString whose Core Text attributes have been converted, where possible, to NSAttributedString attributes. @abstract Returns an NSAttributedString whose Core Text attributes have been converted, where possible, to NSAttributedString attributes.
@param dirtyAttributedString An NSAttributedString that may contain Core Text attributes. @param dirtyAttributedString An NSAttributedString that may contain Core Text attributes.
@result An NSAttributedString that's preserved as many CFAttributedString attributes as possible. @result An NSAttributedString that's preserved as many CFAttributedString attributes as possible.
*/ */
extern NSAttributedString *ASCleanseAttributedStringOfCoreTextAttributes(NSAttributedString *dirtyAttributedString); AS_EXTERN NSAttributedString *ASCleanseAttributedStringOfCoreTextAttributes(NSAttributedString *dirtyAttributedString);
ASDISPLAYNODE_EXTERN_C_END
#pragma mark - #pragma mark -
#pragma mark - #pragma mark -
@@ -88,7 +85,7 @@ ASDISPLAYNODE_EXTERN_C_END
@result An NSParagraphStyle initialized with as many of the paragraph specifiers from `coreTextParagraphStyle` as possible. @result An NSParagraphStyle initialized with as many of the paragraph specifiers from `coreTextParagraphStyle` as possible.
*/ */
+ (instancetype)paragraphStyleWithCTParagraphStyle:(CTParagraphStyleRef)coreTextParagraphStyle NS_RETURNS_RETAINED; + (NSParagraphStyle *)paragraphStyleWithCTParagraphStyle:(CTParagraphStyleRef)coreTextParagraphStyle NS_RETURNS_RETAINED;
@end @end

View File

@@ -172,7 +172,7 @@ NSAttributedString *ASCleanseAttributedStringOfCoreTextAttributes(NSAttributedSt
#pragma mark - #pragma mark -
@implementation NSParagraphStyle (ASTextKitCoreTextAdditions) @implementation NSParagraphStyle (ASTextKitCoreTextAdditions)
+ (instancetype)paragraphStyleWithCTParagraphStyle:(CTParagraphStyleRef)coreTextParagraphStyle NS_RETURNS_RETAINED + (NSParagraphStyle *)paragraphStyleWithCTParagraphStyle:(CTParagraphStyleRef)coreTextParagraphStyle NS_RETURNS_RETAINED
{ {
NSMutableParagraphStyle *newParagraphStyle = [[NSMutableParagraphStyle alloc] init]; NSMutableParagraphStyle *newParagraphStyle = [[NSMutableParagraphStyle alloc] init];

View File

@@ -22,12 +22,8 @@
typedef BOOL (^as_condition_block_t)(void); typedef BOOL (^as_condition_block_t)(void);
ASDISPLAYNODE_EXTERN_C_BEGIN AS_EXTERN BOOL ASDisplayNodeRunRunLoopUntilBlockIsTrue(as_condition_block_t block);
BOOL ASDisplayNodeRunRunLoopUntilBlockIsTrue(as_condition_block_t block); AS_EXTERN void ASDisplayNodeSizeToFitSize(ASDisplayNode *node, CGSize size);
AS_EXTERN void ASDisplayNodeSizeToFitSizeRange(ASDisplayNode *node, ASSizeRange sizeRange);
void ASDisplayNodeSizeToFitSize(ASDisplayNode *node, CGSize size); AS_EXTERN void ASCATransactionQueueWait(ASCATransactionQueue *q); // nil means shared queue
void ASDisplayNodeSizeToFitSizeRange(ASDisplayNode *node, ASSizeRange sizeRange);
void ASCATransactionQueueWait(ASCATransactionQueue *q); // nil means shared queue
ASDISPLAYNODE_EXTERN_C_END