UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; v.backgroundColor = [UIColor colorWithRed:1.0f green:1.0 blue:0.0 alpha:1.0f]; [self.view addSubview:v]; let v:UIView = UIView(frame:CGRectMake(0, 0, 100, 100)); v.backgroundColor = UIColor(red: 1.0, green: 1.0, blue: 0.0, alpha: 1.0); self.view.addSubview(v);