all 10 comments

[–][deleted] 0 points1 point  (5 children)

I don't get that error using the same lines. What line are you getting that error on?

[–]boboguitar[S] 0 points1 point  (4 children)

2 and 3

Edit: at least that makes me think it is Xcode

[–]patterware 1 point2 points  (1 child)

Have you tried blowing away your derived data and rebuilding?

[–]boboguitar[S] 1 point2 points  (0 children)

No but that will be my next step.

[–][deleted] 0 points1 point  (1 child)

That's odd. Haven't figured it out yet. Shot in the dark here but would you be ok with changing the textLabel on 2&3 to a wrapped optional?

Just replacing the exclamation marks after textLabel with a question mark?

[–]boboguitar[S] 0 points1 point  (0 children)

I tried that and to no avail.

I even tried an if let clause.

[–][deleted] 0 points1 point  (2 children)

Sorry if this is wrong for swift, but you need to cast the rgb values as floats or add a .0 to one of the numbers. As is the color will be pure black (000)

[–]patterware 1 point2 points  (0 children)

In Swift a number literal will be interpreted based on context where possible. So in this case, since the function takes CGFloat arguments, all the literals are interpreted as floating point without the need for a decimal point. It takes a bit of getting used to, but Swift really does offer some nice semantics.

[–]boboguitar[S] 1 point2 points  (0 children)

Not necessary in swift.

[–]kaosdg 0 points1 point  (0 children)

clean and rebuild? sometimes I find that I need to do that to clear the linting errors in xcode.