Search code examples
iosobjective-cuicolor

Obj-C - Define UIColor property in NSObject?


I'm trying to define UIColor in an NSObject, but this doesn't seem do-able? Sorry for the basic question, but I can't seem to find why this wouldn't work? The property line throws me the error:

Unknown type name UIColor

MyObject.h

NS_ASSUME_NONNULL_BEGIN

@interface MyDataObject : NSObject

@property (nonatomic) UIColor *userColor;

@end

NS_ASSUME_NONNULL_END

Solution

  • You must import UIKit:

    #import <UIKit/UIKit.h>