Swift 5: How to programmatically put a UIScrollView inside another UIScrollView

Eric Gustin
1 min readJul 13, 2020

--

For this tutorial, we will be embedding a horizontal UIScrollView inside a vertical UIScrollView

Step 1: Define our variables and set up our ViewController’s subviews

Step 2: Now that we have implemented all of our code in ViewController.swift all we need to do is add 6 pictures to our Assets.xcassets folder. If you want the images to appear, then ensure that you have named the image files the same as I have (i.e. 1, 2, 3, 4, 5 and 6).

And that’s it! Enjoy your newfound knowledge of UIScrollViews!

--

--

Eric Gustin
Eric Gustin

Written by Eric Gustin

I make tutorials and articles on Programming, iOS Development, and Mathematics github.com/EricGustin

No responses yet