Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Simple iPhone App with Swift Improving Our User Interface Adding a Pop of Color

Raghav Bhasin
Raghav Bhasin
2,657 Points

UIColor is an unresolved identifier, while running the test code in the playground. How to fix that?

I wrote, var redColor = UIColor(red : 223/255.0, green : 86/255.0, blue : 94/255.0, alpha : 1.0)

2 Answers

Richard Lu
Richard Lu
20,185 Points

Hey Raghav,

The reason you're getting that error is because UIColor is in the UIKit framework. To resolve this issue, just import

import UIKit
Raghav Bhasin
Raghav Bhasin
2,657 Points

I did import it, there was some other error I guess. I switched to iPhone 5s from iPhone 5 and it worked. Thank you.