If I have an UIImageView with the mode set to center for example how can I change it to something else such as aspect fit with code?

If I have an UIImageView with the mode set to center for example how can I change it to something else such as aspect fit with code?
