You can subclass UILabel:
#import <UIKit/UIKit.h>
@interface NMLabel : UILabel
@property (nonatomic, readwrite) NSString *name;
@end
import UIKit
class NMLabel : UILabel {
var name : String = ""
}
Or at the most basic level, you can use an existing property tag(both in Objective-C and in Swift):
label.tag = 5
NSLog(@"%d", label.tag);
print(label.tag)
source
share