Yes, you can.
Directors: this is normal as one of the directors needs to be resident in Switzerland. Most lawyers have this type of assignments as well, but they are not nominees in the "offshore sense" of the word as they will not let you do whatever you want.
Shareholders: In an AG there are no issues, and frankly you do not need it as only the company keeps records of their shareholder. So, unless the company is publicly listed, no one will know.︀ The only thing is that if you incorporate in your name, the incorporation document will︁ name you, and that is publicly availible. The shareholders of a GmBH are made public,︂ so you will have a hard time finding a guy that wants to do be︃ a nominee. I have been dealing with swiss law lawyers for many years and the︄ way they normally do it is to have a corporate sharholder as a nominee. This︅ way, you can stay relatively anonymus. But, please note that all companies are required to︆ have a list of UBOs. So, the company will know.
To be honest I have︇ never checked the regulations on this in Switzerland, but I know that most countries do︈ not have any spesific ban on nominees. Honestly, it is also extremly difficult to enforce︉ that type of ban.