Yes, you can apply for permanent residency in Sweden if you have a Type D visa. You can apply for the permanent residency permit after having the residence permit for 3 years, and it is valid for a lifetime.
The procedure to apply for permanent residency in Sweden is given below.
Step 1: Apply for a residency permit in Sweden
Step 2: After obtaining the residency permit, apply for the Sweden D visa.
Step 3: Check your eligibility for permanent residency
Step 4: Submit the duly filled permanent residency application
Step 5: Wait for the decision