Delay in dark/light mode feature i made

The problem is, the screen ‘‘contact’’ only switch to white mode (when it actived into my app settings) So it takes it 1 second to execute the code.



The screen ‘’ email viewing’’ is apart from the other screens, the ones from the tab bar. and i can’t seem to fix this. thanks.