1.
to name sb/sth to show that you are making a serious promise :
I swear by almighty God that I will tell the truth.
2.
(not used in the progressive tenses) to be certain that sth is good or useful :
She swears by meditation as a way of relieving stress.