From the course: iPadOS 13 Development Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Add adapting color

Solution: Add adapting color - iOS Tutorial

From the course: iPadOS 13 Development Essential Training

Start my 1-month free trial

Solution: Add adapting color

(upbeat techno music) - [Instructor] So what we want to do here is change the color of this image. To do that, head over to the item class and then we're going to go inside of our item struct and create a variable called color that is a UIColor. Then we'll need to add that property each time an item is instantiated. Once I've added one color, I'll just copy and paste the rest of 'em. (mouse clicking) We'll hide the navigator area so I have a little bit more clarity on what I'm writing in my code here. I'm going to change it so there are different colors. And there we go. Let's head back over to our content view and in here, underneath our image, I'm going to type .foregroundColor and then create a color that receives a UIColor and this color is going to come from our item. So item.color. Now let's preview it. (mouse clicking) So I'm going to run the app in the dark mode version. And there are all the different…

Contents