| ### Create a single Chip |
| |
| <!--<div class="material-code-render" markdown="1">--> |
| #### Swift |
| ```swift |
| let chipView = MDCChipView() |
| chipView.titleLabel.text = "Tap me" |
| chipView.setTitleColor(UIColor.red, for: .selected) |
| chipView.sizeToFit() |
| chipView.addTarget(self, action: #selector(tap), for: .touchUpInside) |
| self.view.addSubview(chipView) |
| ``` |
| |
| #### Objective-C |
| |
| ```objc |
| MDCChipView *chipView = [[MDCChipView alloc] init]; |
| chipView.titleLabel.text = @"Tap me"; |
| [chipView setTitleColor:[UIColor redColor] forState:UIControlStateSelected]; |
| [chipView sizeToFit]; |
| [chipView addTarget:self |
| action:@selector(tap:) |
| forControlEvents:UIControlEventTouchUpInside]; |
| [self.view addSubview:chipView]; |
| ``` |
| <!--</div>--> |