Generally speaking, it is recommended, regardless of the cause of the resignation, to keep a courteous tone and be polite - if not friendly. Indeed, paths may cross again in the future and you might actually find yourself having to deal with your former colleagues and superiors again later in your professional life (and even possibly in the context of a recruitment process!).
It is also important to explicitly indicate the effective termination date of your employment, referring to your employment contract, an applicable collective labor agreement, and/or Swiss labor law.
INDEFINITE DURATION EMPLOYMENT CONTRACT
In the case of an indefinite term contract, the Swiss Code of Obligations provisions that once the probationary period has ended, the employment contract may be terminated by respecting a notice period of:
Please note that the termination will only be effective at the end of the month in which the notice period expires.
FIXED TERM EMPLOYMENT CONTRACT
In the case of a fixed term contract, it is neither necessary nor possible to give notice before the fixed term expires, except by mutual agreement of the parties or for just cause. If the worker decides to terminate the contract before its expiration date, the employer is entitled to a severance allowance amounting to the damage caused by the departure.
Here is a sample resignation letter that may be applied in most occurences. You will find that it is not necessary to mention the cause of the resignation in the letter itself.