-1

Here are two @interface in on file, what does the second interface mean with a parentheses () after it ?

@interface JSMessagesViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, UITextViewDelegate, JSMessageInputViewDelegate>

@property (weak, nonatomic) id<JSMessagesViewDelegate> delegate;
@property (weak, nonatomic) id<JSMessagesViewDataSource> dataSource;
@property (weak, nonatomic) id<DownloadXMGameDelegate> downloadXMGameDelegate;

@property (strong, nonatomic) UITableView *tableView;
@property (strong, nonatomic) JSMessageInputView *inputToolBarView;
@property (assign, nonatomic) CGFloat previousTextViewContentHeight;
@property (assign, nonatomic, readonly) UIEdgeInsets originalTableViewContentInset;

@property (nonatomic,strong) NSMutableArray *selectedMarks;

#pragma mark - Initialization
- (UIButton *)sendButton;

#pragma mark - Actions
- (void)sendPressed:(UIButton *)sender;

#pragma mark - Messages view controller
- (BOOL)shouldHaveTimestampForRowAtIndexPath:(NSIndexPath *)indexPath;
- (BOOL)shouldHaveAvatarForRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)finishSend;
- (void)setBackgroundColor:(UIColor *)color;
- (void)scrollToBottomAnimated:(BOOL)animated;

#pragma mark - Keyboard notifications
- (void)handleWillShowKeyboard:(NSNotification *)notification;
- (void)handleWillHideKeyboard:(NSNotification *)notification;
- (void)keyboardWillShowHide:(NSNotification *)notification;

@end


@interface JSMessagesViewController () <JSDismissiveTextViewDelegate>

- (void)setup;

@end
herbertD
  • 10,657
  • 13
  • 50
  • 77
  • 1
    This is called Categories. It is used to add methods into existing (in-built) classes or for private methods in .mm files. Please refer this links: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html https://medium.com/ios-os-x-development/an-introduction-to-categories-in-objective-c-d6d55d91569f Search for the iOS Objective-C Categories for more details – Mrunal Nov 13 '18 at 12:52
  • 1
    That's an "unnamed" extension. If you create yourself an extension, you chose Category (~Objective-C name for an Extension), a file, and your file should be named "InitialClass+YourExtensionName", and `@interface InitialClass (YourExtensionName)` if I remember correctly. https://stackoverflow.com/questions/7136124/class-extension-vs-class-category etc. – Larme Nov 13 '18 at 12:53

1 Answers1

1

It is anonymous category check here

m1sh0
  • 2,236
  • 1
  • 16
  • 21
  • 1
    Please Don't suggest any link in answer. Give link in comment only. –  Nov 13 '18 at 13:03
  • Is it better if you copy the answer :? from somewhere? In end of the day I think the answer of the question is "It is anonymous category" and the link is to have more information. – m1sh0 Nov 13 '18 at 13:05
  • 3
    The problem is if the links becomes dead, then this answer will be useless. – Desdenova Nov 13 '18 at 13:07
  • okay, I will have it in mind. – m1sh0 Nov 13 '18 at 13:08
  • 1
    It is not an anonymous category. It is a *class extension* and it has a very specific purpose that is different from a category. – bbum Nov 13 '18 at 19:51