Using a variable before its declaration in a struct - why does it work?

I’m in the process of getting my head around swift and have been playing around with struct. The following is a cut down version of a struct that works. However, I appear to have used variable names (azimuth & inclination) in a “didSet” construct before its declaration further down in the struct. Why does this work and not raise an error? I can also rearrange the code such that the variables inclination and azimuth are declared above the variables inclinationError and azimuthError and the code works fine, however, there is still the apparent problem of variable names being used before declaration, in this case “azimuthError” and “inclinationError”. Why is the compiler not yelling at me? I’m curious to why I can get away with this.

Example code:
struct PlaneOrientation {
// Structure for the orientation of a geological plane.
let inclinationRange = -90.0…90.0
let azimuthRange = 0.0…360.0
var inclinationError = false {
didSet {
if !(inclinationRange ~= inclination) { inclinationError = oldValue } //////// This is where “inclination” is first used but has not been declared
}
}
var azimuthError = false {
didSet {
if !(azimuthRange ~= azimuth) { azimuthError = oldValue } //////// This is where “azimuth” is first used but has not been declared
}
}
var inclination: Double { // Maximum angle (degrees) of inclination of a plane measured in a vertical plane from the horizontal.
willSet {
if newValue == 0.0 { azimuth = 0.0 }
inclinationError = !(inclinationRange ~= newValue)
}
}
var azimuth: Double { // Bearing of the line of inclination of the plane measured clockwise from North (degrees) in the horizontal.
didSet {
if inclination == 0.0 { azimuth = oldValue }
}
willSet {
azimuthError = !(azimuthRange ~= newValue)
}
}
// Initialisers
init(inclination: Double, azimuth: Double) { // inclination = dip of the plane, azimuth = direction of dip.
self.inclination = inclination
self.azimuth = (inclination == 0.0 ? 0.0 : azimuth)
inclinationError = !(inclinationRange ~= inclination)
azimuthError = !(azimuthRange ~= azimuth)
}
// A few more inits in here
// Getters and Setters in here
// Some local functions in here
}

Some programming languages require properties and functions to be explicitly declared before they are defined.

This makes it possible, for example, to have two functions which each call the other. Whichever function is defined first calls the one defined second; without the declaration of the second function, the compiler would complain the second function does not exist, so the first function couldn’t call it - and this would be true regardless of which order the functions were defined.

Swift isn’t one of those languages. To the programmer, defining a property or function also declares it; having a separate declaration somewhere else is redundant. The Swift compiler is smart enough to accept a definition, recognise any potential properties or functions used, and check that they are defined elsewhere in the program.

Thanks for that. I was expecting to have to have some form of pre-declaration. I could not fined any specific reference to this in the Swift documentation.