Skip to content

Commit

Permalink
Rename ‘setup’ method to avoid potential namespace clashes
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeltyson committed Nov 8, 2020
1 parent ef7a25b commit 00546d1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions TPKeyboardAvoiding/TPKeyboardAvoidingCollectionView.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ @implementation TPKeyboardAvoidingCollectionView

#pragma mark - Setup/Teardown

- (void)setup {
- (void)setupKeyboardAvoiding {
if ( [self hasAutomaticKeyboardAvoidingBehaviour] ) return;

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(TPKeyboardAvoiding_keyboardWillShow:) name:UIKeyboardWillChangeFrameNotification object:nil];
Expand All @@ -26,19 +26,19 @@ - (void)setup {

-(id)initWithFrame:(CGRect)frame {
if ( !(self = [super initWithFrame:frame]) ) return nil;
[self setup];
[self setupKeyboardAvoiding];
return self;
}

- (id)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout {
if ( !(self = [super initWithFrame:frame collectionViewLayout:layout]) ) return nil;
[self setup];
[self setupKeyboardAvoiding];
return self;
}

-(void)awakeFromNib {
[super awakeFromNib];
[self setup];
[self setupKeyboardAvoiding];
}

-(void)dealloc {
Expand Down
6 changes: 3 additions & 3 deletions TPKeyboardAvoiding/TPKeyboardAvoidingScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ @implementation TPKeyboardAvoidingScrollView

#pragma mark - Setup/Teardown

- (void)setup {
- (void)setupKeyboardAvoiding {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(TPKeyboardAvoiding_keyboardWillShow:) name:UIKeyboardWillChangeFrameNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(TPKeyboardAvoiding_keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scrollToActiveTextField) name:UITextViewTextDidBeginEditingNotification object:nil];
Expand All @@ -24,13 +24,13 @@ - (void)setup {

-(id)initWithFrame:(CGRect)frame {
if ( !(self = [super initWithFrame:frame]) ) return nil;
[self setup];
[self setupKeyboardAvoiding];
return self;
}

-(void)awakeFromNib {
[super awakeFromNib];
[self setup];
[self setupKeyboardAvoiding];
}

-(void)dealloc {
Expand Down
8 changes: 4 additions & 4 deletions TPKeyboardAvoiding/TPKeyboardAvoidingTableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ @implementation TPKeyboardAvoidingTableView

#pragma mark - Setup/Teardown

- (void)setup {
- (void)setupKeyboardAvoiding {
if ( [self hasAutomaticKeyboardAvoidingBehaviour] ) return;

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(TPKeyboardAvoiding_keyboardWillShow:) name:UIKeyboardWillChangeFrameNotification object:nil];
Expand All @@ -26,19 +26,19 @@ - (void)setup {

-(id)initWithFrame:(CGRect)frame {
if ( !(self = [super initWithFrame:frame]) ) return nil;
[self setup];
[self setupKeyboardAvoiding];
return self;
}

-(id)initWithFrame:(CGRect)frame style:(UITableViewStyle)withStyle {
if ( !(self = [super initWithFrame:frame style:withStyle]) ) return nil;
[self setup];
[self setupKeyboardAvoiding];
return self;
}

-(void)awakeFromNib {
[super awakeFromNib];
[self setup];
[self setupKeyboardAvoiding];
}

-(void)dealloc {
Expand Down

0 comments on commit 00546d1

Please sign in to comment.