title: How to create progress bar based on an image in Swift
body: <p>Is there a way I can create a progress bar based on an image like <a href="https://i.stack.imgur.com/ouBPj.png" rel="nofollow noreferrer">here</a>?</p>
  
  <p>The user is supposed to build a building and I wanted to show the progress of the building process.
  <strong>Example:</strong> if the progress is 50%, the top 50% of the building should be cut off.</p>
  
  <p>I tried to put an image inside a UIImageView with alpha 0.3 to show what the eventual building would look like. Like <a href="https://i.stack.imgur.com/SPaxl.png" rel="nofollow noreferrer">here</a>.</p>
  
  <p>And I tried to put the same image inside a UIImageView with alpha: 1.0, Clip To Bounds selected and contentmode: Aspect fill so I could programmatically change the height of the UIImageView according to the progress. But as you see in the image the building moves a bit if you change the height of the UIImageView. Like <a href="https://i.stack.imgur.com/vrLkk.png" rel="nofollow noreferrer">here</a>.</p>