Swear in this context is also a slang reference which refers to a "swearing in", which is to take an oath.
In this regard "swear" is very similar to "promise".
Examples:
"I swear I will be back before supper." is the same as
"I promise to be back before supper."
Just be sure not to say "swear at". This generally means you are going to use bad words when speaking to someone.