This is a bit awkward actually and won't work out of the box. You can potentially do this using constraints and wrapping the image in a uiview. Otherwise perhaps this open source will help [UIImageViewAligned](https://github.com/sochalewski/UIImageViewAlignedSwift)
– quinJun 22 '18 at 12:51