Using Scroll View with Autolayout Swift
<p>I know this question has been asked many times but this is a problem I have been struggling with for a long time and I'm sure others are too, even with the current answers and tutorials out there.</p>

<p>When adding a Scroll View I go through the following steps:</p>

<ol>
<li><p>Add a Scroll View as a subview of the original view in the view controller. Pin top, left, right, and bottom. Ensuring that "Constrain to margins" is unchecked.</p></li>
<li><p>Add a UIView as a subview of the Scroll View. Pin top, left, right, and bottom constraints. </p></li>
<li><p>Add an equal widths constraint between the content view and the view controllers view.</p></li>
</ol>

<p>At this point of I run the app the content view does not appear and the scroll View takes up the entire screen.</p>

<ol start="4">
<li>Next I add elements to the Content View that just include 4 UIViews to test everything. I give each UIView top, left, and right constraints. And the last UIView a bottom constraint.</li>
</ol>

<p>Not at this point when I run the app the Content View and Scroll View each take up about half of the screen and I can scroll the Content View around. See below photo.</p>

<p>I have followed every tutorial I can find and tried implementing all SO answers I have found but I can't seem to get it to work. If anybody has come across this or knows a solution your help would be very much appreciated!</p>

<p>The green is the Content View and the blue is the Scroll View</p>

<p><a href="https://i.stack.imgur.com/4Tyyo.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/4Tyyo.jpg" alt="enter image description here"></a></p>

<p>Scroll View and Subview constraints</p>

<p><a href="https://i.stack.imgur.com/KQjWD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KQjWD.png" alt="enter image description here"></a></p>