If you know when applying that you will need to stay in Sweden for longer than three months, you should apply for a residence permit for a visit.
It is the Swedish Migration Agency that considers your right to a visitor’s permit. If the application is granted, the visitor’s permit can be issued with a validity between three and twelve months. The visitor’s permit should not be used as a multiple entry visa to visit Sweden several times during the period of its validity. You are expected to apply for the period that you intend to stay in Sweden. Any misuse of previously granted visitor’s permit may affect future applications for visitor’s permit as well as Schengen visas.
If you are to be granted a residence permit for a visit, the purpose of the trip must be to visit Sweden, not to settle there. You must have the means to support yourself throughout your stay. Medical travel insurance is compulsory since medical costs can be high.