Swedish Police is required to control everyone entering or leaving Sweden to and from countries which are not part of the Schengen Area. Border controls at external borders are mandatory regardless of citizenship.
Entry and exit regulations differ depending on your citizenship, which country you travel to or from, your purpose for travelling, and the length of your stay.
TRAVELLING INSIDE THE EU/EEA
Inside the EU/EEA, the general rule is free movement, with certain exceptions. This means that entry to and exit from the EU/EEA is always controlled, but most often, border controls are not performed inside the Schengen Area. A temporary border control at an internal border can however be performed, this means that you should always be able to document for example your identity, citizenship, and right to stay in Sweden.
A more basic border control is performed when travelling between Sweden and non-Schengen EU countries.
TRAVELLING TO OR FROM A THIRD COUNTRY
Border control will always be performed when travelling to or from third countries (countries outside of the EU/EEA). When entering or leaving the Schengen Area, border control will be performed in the Schengen State (country in the Schengen Area) of first entry and last exit. If you travel via Sweden as the first or last Schengen State, border control will be performed in Sweden. If you transit via another Schengen State before entry to Sweden, or after exit from Sweden, you will most likely be processed for entry to or exit from the Schengen Area in that country. Questions about entry to or exit from the Schengen Area must then be posed to the border control authority in that Schengen State.
MORE INFORMATION
Border control | The Swedish Police Authority (polisen.se)
Travel with children | The Swedish Police Authority (polisen.se)