Learn Courses My Dashboard

Code colours in Swift

Sometimes Xcode makes my variable names appear in a bluish-teal colour, while other times they appear in white–and I can’t figure out why.

Right now I have two Swift projects open side-by-side, both set to iOS 16, with the exact same text–displayed in different colours.

import Foundation

struct Recording: Equatable {
    let fileURL: URL
    let createdAt: Date

…and the variable names appear in different colours in each project.

What is Xcode trying to tell me?

It’s just that Xcode sucks.

Sometimes it compiles properly and properly syntax highlights things, other times it doesn’t.

Do both projects compile?

Also try cleaning both projects and rebuilding both


I cleaned both build folders and both projects build and run properly.

I guess I should just get over it. I thought I must be missing something…

Nope, it’s just Xcode struggling