Circuit of a potentiometer with switch
The switch and the potentiometer are completely independant.
the 2-pin connector is for the switch and the 3-pin for the potentiometer.
VCC and ground are connected to the lateral pins of the pentiometer the middle one is the output variable voltage.