They 'swore' (an oath of) allegiance to the United States of America. [=they formally promised that they would be loyal to the United States of America]
He 'swore us to secrecy/silence'. [=he made us promise not to tell anyone his secret]
He was so disgusted by the election results that he 'swore off' politics for good.
(..) I give them no excuse to take them. I am the king's cousin. I must look after these people. My purpose in coming was not to hurt you. I swore to your brother I would protect you. You cannot replace my brother. I don't want to replace him. I return to find my home destroyed and my father murdered. (..)1991 Robin Hood: Prince of Thieves