Skip to content

Commit

Permalink
Suppress NS_DESIGNATED_INITIALIZER warning
Browse files Browse the repository at this point in the history
`-[UIView initWithFrame:]` is annotated with the
`NS_DESIGNATED_INITIALIZER` macro so it is expected that subclasses
will invoke the superclass’s implementation. Because we load our user
interface from a nib but still want to allow users to initialize an
instance with `-initWithFrame:`, we do not call super and instead
assign `self` to the result of unarchiving the aforementioned nib. This
causes a warning to be emitted about not calling `super`.

Since we know what we’re doing, we can work around this warning by just
calling `super` before we unarchive from the nib to appease the
compiler.
  • Loading branch information
hyperspacemark committed Sep 30, 2015
1 parent 1dc074a commit 0b962da
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions VENTokenField/VENToken.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ @implementation VENToken

- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
self = [[[NSBundle bundleForClass:[self class]] loadNibNamed:NSStringFromClass([self class]) owner:self options:nil] firstObject];
if (self) {
[self setUpInit];
Expand Down

0 comments on commit 0b962da

Please sign in to comment.