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.
(..) Alright, everyone carry on, carry on. Maybe I did hex that Bell girl. Maybe I didn't. What about you? I swore to protect you. I made the Unbreakable Vow. I don't need protection. I was chosen for this. I don't know (..)2009 Harry Potter and the Half-Blood Prince