And employers know that the visa/work permit process is easy, quick (typically a few weeks) and predictable, so there is a lot less bias against foreign applicants than in e.g. the US.
IMO Scandinavia is actually a great place to be a freelancer, even for foreigners, if you can build a modest network. High cost of living, but no worry about health/benefits being tied to your job, very English-friendly, and a lot of part-time/freelance tech work that pays well. But it's very hard to get the formalities sorted out for that, unless you first get an EU citizenship or permanent residency via another route.
You need to reapply for the work permit when you change jobs or every two years (max validity duration), which is quite painless. After 4 years you should get permanent residence, and no longer need any permits.. This is the process for most non-EU residents.
There is some debate over adding a Swedish-language requirement, but there isn't currently one. That is one of the two difference with Denmark: if you're a non-EU immigrant to Denmark, you need to live there 5 years under the same conditions rather than 4, plus pass a middle-level Danish competency exam.
The aspect which provides the lowest barrier to entry is that English is spoken widely and well in Stockholm. One somewhat funny and repeated experience is thinking you are being greeted with a friendly American-English "hey!" when entering a store or restaurant, but in fact it is the Swedish greeting "hej", haha.
But on average you'll have to live in a lot smaller house/apartment, make less money after taxes, suffer the cold climate (unless you love winter sports). The startup scene is 1/1000th of the Valley.
The weather is not a problem, I love cold climates :)