How can I implement the photos swiping like iOS Photos app using the UIPageViewController?

Samir K

Suppose I have a large array of photoIds which I can use in the Photos APP requestPhoto API to fetch a photo. How can I implement the UIPageViewController to accommodate a large array as such. Wouldn't creating a view controller for each of these photos on swiping left/right cause a degradation of performance of the App. Could anyone suggest a better approach to this? I've looked everywhere but couldn't find anything. I suppose another way to frame this question would be 'How can I implement the UIPageViewController with a dynamic set of data instead of a static number?

Samir K

For anyone else struggling with the same issue. I found this video very helpful. https://www.youtube.com/watch?v=ItdPXinQOp8?

According to this, I made an array with lazy var that pushes all the view controllers in the array. The view controller is only loaded when it is needed so that prevents any performance degradation. So it doesn't matter if you have n number of view controllers.

So basically the approach will be:

  1. Have an array with all the imageIDs you want to swipe through
  2. Make a lazy var newArray which will iterate through the imageIDs(Array) and fetch the images with an api call. Dont worry it will only call the api when required. Initialize the Detailed View controller with the received image and push viewcontroller in newArray.
  3. Set up UIPagecontroller delegates as usual using the newly formed array of all the viewcontrollers.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to enumerate all photos on iOS 8 using ALAssetsLibrary

How can IOS Photos app can show hundreds of photos in one screen?

With the iOS Photos Framework how do I list all PHAssetCollections available?

How to add photos to photo library in IOS 8 using Photos framework

MultiSelect gesture like Google Photos app

How can a universal windows app have multiple independent windows (Like Microsoft's app “Photos”)?

iOS Swift: How to recreate a Photos App UICollectionView Layout

How can I upload multiple photos to a Laravel application through ajax using vanilla javascript?

iOS image viewer or preview exact like photos app using collection view (paging enabled) with minimum line spacing

How Do I Print Photos?

How can I find duplicate photos?

How can I read and remove meta (exif) data from my photos using the command line?

How can I rename photos, given the EXIF data?

My iOS App Terminated due to Memory Pressure when I am using Photos.app

iOS 7 photos app like custom UIViewController Transition

How can I have background photos changing in iOS 7 and Xcode 5 application?

How can I get geotagged photos for all users using flickr api?

How to upload photos in iphone app?

How do I share photos with Photos?

How can I view .HEIC photos on Linux?

How can I search for photos by height or width?

I am trying to upload Video from "Photos" app using Html 5 form for iOS devices

How to get image metadata in iOS 9 using Photos Framework

How can I implement the iPhone Photos editing drawer?

iOS how to place header in collection view of date between photos as in iPhone photos app

How many photos can I display on a webpage

How can I scan multiple photos at once

How can I limit the number of photos my aiogram bot sends

How can I make Picasa see changes I make to photos using jhead?