I want to ask what is window means in apps..i mean which one..because if i dont write it,the appearance still didnt change

All your views (UIView objects) live inside a window (a UIWindow object). Normally you don’t need to worry about this, but if you set the tintColor on the window, then all views will automatically use that same tintColor.

If the appearance doesn’t change for you, then make sure the method that you added this line to actually gets called. You can do this by adding a print() statement just above or below the window!.tintColor = line, or by setting a breakpoint.

this is the error

That seems like selectedIndexPath is nil.

i thought about that too but is it okey to eliminate this code and is it didnt give any effect on app?