Add main thread warnings and setter/getter assert

This commit is contained in:
Roy Marmelstein
2015-07-12 21:35:42 +02:00
parent 95016021b4
commit fd3eb94fcb
2 changed files with 21 additions and 2 deletions

View File

@@ -19,7 +19,10 @@
#pragma mark - Configuration
//! @abstract Access to underlying UITextView for more configuration options.
/**
@abstract Access to underlying UITextView for more configuration options.
@warning This property should only be used on the main thread and should not be accessed before the editable text node's view is created.
*/
@property (nonatomic, readwrite, strong) UITextView *textView;
//! @abstract The attributes to apply to new text being entered by the user.

View File

@@ -41,6 +41,7 @@
{
@private
// Configuration.
UITextView *_textView;
NSDictionary *_typingAttributes;
// Core.
@@ -134,7 +135,7 @@
[self.view addSubview:_placeholderTextKitComponents.textView];
// Create and configure our text view.
_textKitComponents.textView = _textView;
_textKitComponents.textView = _textView;
//_textKitComponents.textView = NO; // Unfortunately there's a bug here with iOS 7 DP5 that causes the text-view to only be one line high when scrollEnabled is NO. rdar://14729288
_textKitComponents.textView.delegate = self;
_textKitComponents.textView.editable = YES;
@@ -189,6 +190,21 @@
#pragma mark - Configuration
@synthesize delegate = _delegate;
#pragma mark -
@dynamic textView;
- (UITextView *)textView{
ASDisplayNodeAssertMainThread();
return _textView;
}
- (void)setTextView:(UITextView *)textView
{
ASDisplayNodeAssertMainThread();
_textView = textView;
}
#pragma mark -
@dynamic typingAttributes;