You can use the GtkSpinButton::input signal to transform the contents of the spin button into a floating point value that can be mapped onto the adjustment; and the GtkSpinButton::output signal to transform a floating point value coming from the adjustment into the contents of the spin button’s text area.
I had the feeling that that one is an outdated page. The example used
gtk_spin_button_set_text() which seems to be not available in recent GTK4 API docs or on my local Linux computer. And not in the recent GTK4 GIR file.
The example code is likely out of date; GtkSpinButton implements the GtkEditable interface, so calling gtk_editable_set_text() will replace gtk_spin_button_set_text().