Skip to content

Commit

Permalink
swift api compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ibireme committed Feb 27, 2016
1 parent 4799ca9 commit e97923c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
10 changes: 6 additions & 4 deletions YYAsyncLayer/YYAsyncLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ FOUNDATION_EXPORT const unsigned char YYAsyncLayerVersionString[];
#import "YYTransaction.h"
#endif


@class YYAsyncLayerDisplayTask;

NS_ASSUME_NONNULL_BEGIN

/**
The YYAsyncLayer class is a subclass of CALayer used for render contents asynchronously.
Expand Down Expand Up @@ -60,7 +60,7 @@ FOUNDATION_EXPORT const unsigned char YYAsyncLayerVersionString[];
@param layer The layer.
*/
@property (nonatomic, copy) void (^willDisplay)(CALayer *layer);
@property (nullable, nonatomic, copy) void (^willDisplay)(CALayer *layer);

/**
This block is called to draw the layer's contents.
Expand All @@ -73,7 +73,7 @@ FOUNDATION_EXPORT const unsigned char YYAsyncLayerVersionString[];
@param isCancelled If this block returns `YES`, the method should cancel the
drawing process and return as quickly as possible.
*/
@property (nonatomic, copy) void (^display)(CGContextRef context, CGSize size, BOOL(^isCancelled)(void));
@property (nullable, nonatomic, copy) void (^display)(CGContextRef context, CGSize size, BOOL(^isCancelled)(void));

/**
This block will be called after the asynchronous drawing finished.
Expand All @@ -82,6 +82,8 @@ FOUNDATION_EXPORT const unsigned char YYAsyncLayerVersionString[];
@param layer The layer.
@param finished If the draw process is cancelled, it's `NO`, otherwise it's `YES`;
*/
@property (nonatomic, copy) void (^didDisplay)(CALayer *layer, BOOL finished);
@property (nullable, nonatomic, copy) void (^didDisplay)(CALayer *layer, BOOL finished);

@end

NS_ASSUME_NONNULL_END
6 changes: 5 additions & 1 deletion YYAsyncLayer/YYSentinel.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,21 @@

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/**
YYSentinel is a thread safe incrementing counter.
It may be used in some multi-threaded situation.
*/
@interface YYSentinel : NSObject

/// Returns the current value of the counter.
@property (atomic, readonly) int32_t value;
@property (readonly) int32_t value;

/// Increase the value atomically.
/// @return The new value.
- (int32_t)increase;

@end

NS_ASSUME_NONNULL_END
4 changes: 4 additions & 0 deletions YYAsyncLayer/YYTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/**
YYTransaction let you perform a selector once before current runloop sleep.
*/
Expand All @@ -36,3 +38,5 @@
- (void)commit;

@end

NS_ASSUME_NONNULL_END

0 comments on commit e97923c

Please sign in to comment.