-2
Скажем, у меня есть что-то подобное в Objective-CКак установить UIColor UIBezierPath в Swift?
- (void)drawRect:(CGRect)rect {
if (1 < [_points count]) {
UIBezierPath *path = [UIBezierPath bezierPath];
[path setLineWidth:3.];
MyPoint *point = _points[0];
[path moveToPoint:point.where];
NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
for (int i = 1; i < (int)_points.count; ++i) {
point = _points[i];
[path addLineToPoint:point.where];
float alpha = 1;
if (1 < now - point.when) {
alpha = 1 - MIN(1, now - (1+point.when));
}
[[UIColor colorWithWhite:0 alpha:alpha] set]; //THIS LINE
[path stroke];
path = [UIBezierPath bezierPath];
[path setLineWidth:3.];
[path moveToPoint:point.where];
}
}
}
Как бы сделать следующую строку [[UIColor colorWithWhite:0 alpha:alpha] set];
в Swift?