I am new to objective c. I am trying to implement a custom UITableViewDataSource and delegate.
I created an NSObject subclass and added the following code.
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface TableViewDataSourceDelegate : NSObject <UITableViewDelegate, UITableViewDataSource>
@end
NS_ASSUME_NONNULL_END
I get this error.
Cannot find interface declaration for 'UIViewController', superclass of 'TableViewDataSourceDelegate'
What am i missing?
CodePudding user response:
Try adding
#import <UIKit/UIKit.h>
UI*
classes are part of UIKit
. Not Foundation
. You can just import UIKit
and remove the Foundation
, because the former depends on latter and imports it automatically.