Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure all ASDisplayNode properties have backing ivars for consistency. #1475

Merged
merged 2 commits into from
Apr 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Source/ASDisplayNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#import <AsyncDisplayKit/ASLayoutElement.h>
#import <AsyncDisplayKit/ASLocking.h>

#pragma clang diagnostic push
#pragma clang diagnostic error "-Wobjc-missing-property-synthesis"

NS_ASSUME_NONNULL_BEGIN

#define ASDisplayNodeLoggingEnabled 0
Expand Down Expand Up @@ -987,3 +990,5 @@ typedef NS_ENUM(NSInteger, ASLayoutEngineType) {
@end

NS_ASSUME_NONNULL_END

#pragma clang diagnostic pop
36 changes: 36 additions & 0 deletions Source/ASDisplayNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2635,6 +2635,42 @@ - (BOOL)placeholderShouldPersist
return NO;
}

- (BOOL)placeholderEnabled
{
MutexLocker l(__instanceLock__);
return _placeholderEnabled;
}

- (void)setPlaceholderEnabled:(BOOL)placeholderEnabled
{
MutexLocker l(__instanceLock__);
_placeholderEnabled = placeholderEnabled;
}

- (NSTimeInterval)placeholderFadeDuration
{
MutexLocker l(__instanceLock__);
return _placeholderFadeDuration;
}

- (void)setPlaceholderFadeDuration:(NSTimeInterval)placeholderFadeDuration
{
MutexLocker l(__instanceLock__);
_placeholderFadeDuration = placeholderFadeDuration;
}

- (NSInteger)drawingPriority
{
MutexLocker l(__instanceLock__);
return _drawingPriority;
}

- (void)setDrawingPriority:(NSInteger)drawingPriority
{
MutexLocker l(__instanceLock__);
_drawingPriority = drawingPriority;
}

#pragma mark - Hierarchy State

- (BOOL)isInHierarchy
Expand Down
17 changes: 3 additions & 14 deletions Source/Private/ASDisplayNodeInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ static constexpr CACornerMask kASCACornerAllCorners =
UIImage *_placeholderImage;
BOOL _placeholderEnabled;
CALayer *_placeholderLayer;
NSTimeInterval _placeholderFadeDuration;

NSInteger _drawingPriority;

// keeps track of nodes/subnodes that have not finished display, used with placeholders
ASWeakSet *_pendingDisplayNodes;
Expand Down Expand Up @@ -351,20 +354,6 @@ static constexpr CACornerMask kASCACornerAllCorners =
*/
- (void)enumerateInterfaceStateDelegates:(void(NS_NOESCAPE ^)(id<ASInterfaceStateDelegate> delegate))block;

/**
* // TODO: NOT YET IMPLEMENTED
*
* @abstract Prevents interface state changes from affecting the node, until disabled.
*
* @discussion Useful to avoid flashing after removing a node from the hierarchy and re-adding it.
* Removing a node from the hierarchy will cause it to exit the Display state, clearing its contents.
* For some animations, it's desirable to be able to remove a node without causing it to re-display.
* Once re-enabled, the interface state will be updated to the same value it would have been.
*
* @see ASInterfaceState
*/
@property (nonatomic) BOOL interfaceStateSuspended;

/**
* This method has proven helpful in a few rare scenarios, similar to a category extension on UIView,
* but it's considered private API for now and its use should not be encouraged.
Expand Down