First I thought Xcode is buggy so I restarted Xcode, but the problem stayed even after rebooting the mac.
I then figured out, that a semicolon after .default
or the declaration of another variable fixes it.
I think Xcode thinks the assignment isn't over after .default
, but I'm curious if there is more to it / a better explanation why that is.
func setupNotificationHandling() {
let notificationCenter = NotificationCenter.default
// Can't access notificationCenter via autocompletion here
}