7/15/2023 0 Comments Flowlayout supplemental view![]() If you’ve never used UICollectionView before, it might be worth familiarizing yourself with the basics before continuing. It’s a very simple view controller class to display an image, nothing exciting going on there. If you’re interested, open PhotoDetailViewController.swift. It then applies the snapshot to the collection view data source.įinally, in the UICollectionViewDelegate extension at the bottom of the file, you can see that the app navigates to a PhotoDetailViewController when the user selects an item. viewDidLoad() sets up a basic UICollectionView to display PhotoItemCells by calling configureCollectionView(), which configures the collection view data source using iOS 13’s new UICollectionViewDiffableDataSource.ĭon’t worry if you haven’t come across UICollectionViewDiffableDataSource before! The important part to notice is that configureDataSource() calls snapshotForCurrentState(), which builds a data source snapshot from a list of photo URLs. The initializer for AlbumDetailViewController takes a URL to a folder containing images. ![]() When the app starts, it sets an AlbumDetailViewController as the initial view controller. Switch to Xcode and take a quick look around the project. You can scroll the list to view the photos in the album and tap on any individual photo to view the image in more detail. You will see a functional, but very simple, app displaying a photo album. ![]() It isn’t necessary to do the same to follow the tutorial, but your app will look different from the screenshots if you don’t.ĭownload the project materials using the Download Materials button at the top or bottom of this tutorial. Note: The screenshots of the project in this tutorial use iOS 13’s new dark mode.
0 Comments
Leave a Reply. |