When do swaddle your LO

AB

Do you swaddle your baby before you rock him to bed or after he falls asleep? I always swaddle my baby after he falls asleep and sometimes he wakes up from it so I’m wondering if I have been doing it right ? Lol.