Yes, both the defendant and witnesses may choose to affirm rather than to swear. Tell the clerk to the court in advance, if possible. When you come to the point of affirming, the clerk will first read a list of possible reason why you don't want to take an oath (like being an atheist, etc). You don't need to state the specific reason, just confirm that it's one of those on the list (this is to preclude reasons like "I am religious, but I have no intention of telling the truth"!). After you've confirmed the reason, you will be asked to repeat a non-religious promise to tell the truth.