I sometimes struggle with iOS because I don’t know what some things are called. What element is it where a user can swipe left or right and it will load a display screen. I’ve seen a few examples of this, things for days of the week and Instagram has an example. If you navigate to the heart symbol, there’s a “following” and a “you” in the navbar and you can swipe between views - what’s that called in iOS, I’m assuming it’s an object I can drop into my views?
It isn’t a standard iOS component, but I can speculate about how I’d attempt to replicate it.
Create a view controller with a scroll view in it, full-screen. The scroll view should have paging enabled.
Put three child view controllers into the scroll view (in a storyboard, use three container UIViews and the view controllers will be embedded for you).
Arrange the three child views so they’re stacked horizontally in the scroll view, and the same size as it. So, the scroll view and the three child views are all the same dimensions as the screen, but the scroll view’s content view will be the same height as the screen and three times as wide.
Set up the scroll view’s paging so the middle screen is visible on loading. The left and right screens will be available at a scroll.
Now create your content in your three screens. If you’re copying Instagram then you’ll have a view controller embedded in a navigation controller embedded in a view in your scroll view.
The view controller containing the scroll view can use
prepareForSegue and the embed segues to load content into the embedded view controllers. You might use this to set up delegates so the left and right screens can force the scroll view back to centre.
You could also look at a UIPageViewController, if you anticipate scrolling more than one screen to either side.
Thanks for this, I’ll have a look more into this. I’ve seen it become more and more popular and just assumed it was something native. It’s cool though