My ankle hurts when I walk on it and is swollen. What do I do? I think I twisted it.

Try rice diet. First try rest, ice, compression ( ace wrap), and elevation. If that doesn't help, see your local podiatrist.
RICE. Rest, ice compression and elevation. Stay off your feet as much as possible, ice 20-30 min several times a day, ace wrap if you have one and elevated above heart level or above if possible. Antiinflammatories as tolerated. See you doctor for a good eval. Dr l.