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.
(..) If Thanos needs all six, why don't we just stick this one down a garbage disposal? No can do. We swore an oath to protect the Time Stone with our lives. And I swore off dairy... but then Ben & Jerry's named a flavor after me. - Stark Raving Hazelnuts. (..)2018 Avengers: Infinity War