A NullReferenceException (NRE) is a special kind of exception that is raised when trying to access a member of a nil reference, such as calling a method or reading/writing the property of an uninitialized field or variable.

In Swift, NREs can happen when force-unwrapping a variable that contains nil with the ! operator, or when accessing a variable that is declared to implicitly unwrap (by the ! type name suffix) that has not been initialized to a non-nil value yet.

In the other languages, NREs can happen when accessing any not-non-nullable variable that may be nil/null, or when force-passing a nil/null value to a non-nullable parameter or variable.

See Also