Canton SZ is the only canton with a leash law in force for all public spaces in the canton, including hiking trails.
In all other cantons you will need to check local regulations as Medea has said. Again, watch for signs. Be aware that some areas require a dog be leashed after dark.
---
Be aware that:
Dogs are forbidden in the Swiss National Park. This is a wildlife protection area.
In all cantons where a Naturschutzgebiet (nature conservancy area) is signed, dogs must be on lead.
ETA: During the spring, dogs must be on lead in most forested areas in most cantons. This is to protect animals with young.
Do make sure you understand when the various hunting seasons are, and avoid those zones at those times. If you find yourself in a wood during hunting season, keep your dog on lead and very close. Hunters have been known to mistake a dog for a deer, with tragic consequences.
---
Your dog must be under control at all times. That can be under voice control, provided that your dog is instantly recallable. If recall is less than perfect, the dog should be on lead.
---
Some general etiquette:
Even in areas where dogs are allowed off lead, if someone asks you to recall or releash your dog you should do so, bringing your dog to heel and keeping him there until that person passes. It is the polite and responsible thing to do - especially on hiking trails where other people might feel uncomfortable around an off-lead dog.
You should recall your dog to heel and give way when a bicycle approaches - cyclists are supposed to ring their bells with enough time to allow you to do so. Take your dog off the trail, keeping him to heel until the bike passes.
You should never allow your dog to approach another person without the person's consent.
You should never allow your dog to approach another dog without the owner's consent. When you see a person or dog approaching, recall your dog to heel and take the two seconds necessary to ask if the dogs may greet one another. If you see a dog on lead, that is a signal that the owner does not want contact - recall your dog to heel.
Keep out of pastures where cows/sheep are grazing. If you have to cross, skirt the outline even if it means going a bit out of your way. If you see a farmer in the field, ask his permission before crossing his fields.
Do not enter a field with a mother cow and her calf. Seriously. If you absolutely have no way around, put your dog on lead and skirt the edges, keeping well away.
And of course - always pick up after your dog. You will find green Robidog containers dotting the trails - even many mountain trails. These are where you may dispose of bagged dog waste, these also dispense bags. Use them. Especially in farm pastureland. Dog waste is a serious problem for farmers.
Be aware that many people in Switzerland are afraid of dogs, so be polite, be proactive to put others at ease - and never, ever utter the words 'He just wants to play! or 'Der macht nichts!'
This all boils down to: Be respectful of others who are sharing your space.
Oh, and a safety tip:
Pastures are often fenced with a live electric wire. Don't touch them - and keep your dog well away. The current is set to make a large cow take notice - think of what that might do to your dog.
Hope you and your friend enjoy Switzerland - Happy trails!
*** Yes, I know that some people ignore the laws, ignore basic etiquette. They are the idiots who give us all a bad name.
Switzerland is indeed dog friendly, as long as you respect others. If you do so, you will likely be greeted by smiles and a friendly 'hello' - and perhaps your four-footed friend might even be surprised with a gratis cervelat at a local Gasthaus.