Diffable Data Sources - Beginning CollectionViews in iOS - Swift 5, Xcode 11

  Рет қаралды 6,532

Kodeco

Kodeco

4 жыл бұрын

A diffable data source is a dedicated object that handles the provision of data to the collection view. Get a high-level understanding of data sources in this episode.
Watch the complete course here:
www.raywenderlich.com/5429927...
This course is part of our iOS and Swift for Beginners Learning Path. You're ready for this course if you're working through that learning path in order, or you're someone who has just a little bit of iOS and Swift experience.
You'll start off by building a simple collection view that displays numbers is rows and grids using brand new diffable data sources and compositional layout APIs.
Then, you'll take a small detour to build an emoji library app using pre-iOS 13 API by implementing data sources and flow layouts.
Finally, you'll combine the two approaches to build a RayWenderlich.com library app that lets you browse courses.
Throughout the course, you'll practice everything you learn with hands-on challenges.
This course isn’t suited for intermediate or advanced developers. If that’s you, check out our intermediate or advanced video courses for more ways to level-up your developer skills!
From Apple's Documentation:
developer.apple.com/documenta...
An object that manages an ordered collection of data items and presents them using customizable layouts.
When adding a collection view to your user interface, your app’s main job is to manage the data associated with that collection view. The collection view gets its data from the data source object, which is an object that conforms to the UICollectionViewDataSource Protocol and is provided by your app. Data in the collection view is organized into individual items, which can then be grouped into sections for presentation. An item is the smallest unit of data you want to present. For example, in a photos app, an item might be a single image. The collection view presents items onscreen using a cell, which is an instance of the UICollectionViewCell class that your data source configures and provides.
In addition to its cells, a collection view can present data using other types of views too. These supplementary views can be things like section headers and footers that are separate from the individual cells but still convey some sort of information. Support for supplementary views is optional and defined by the collection view’s layout object, which is also responsible for defining the placement of those views.
Besides embedding it in your user interface, you use the methods of UICollectionView object to ensure that the visual presentation of items matches the order in your data source object. Thus, whenever you add, delete, or rearrange data in your collection, you use the methods of this class to insert, delete, and rearrange the corresponding cells. You also use the collection view object to manage the selected items, although for this behavior the collection view works with its associated delegate object.
Collection Views and Layout Objects
A very important object associated with a collection view is the layout object, which is a subclass of the UICollectionViewLayout class. The layout object is responsible for defining the organization and location of all cells and supplementary views inside the collection view. Although it defines their locations, the layout object does not actually apply that information to the corresponding views. Because the creation of cells and supplementary views involves coordination between the collection view and your data source object, the collection view actually applies layout information to the views. Thus, in a sense, the layout object is like another data source, only providing visual information instead of item data.
You normally specify a layout object when creating a collection view but you can also change the layout of a collection view dynamically. The layout object is stored in the collectionViewLayout property. Setting this property directly updates the layout immediately, without animating the changes. If you want to animate the changes, you must call the setCollectionViewLayout(_:animated:completion:) method instead.
If you want to create an interactive transition-one that is driven by a gesture recognizer or touch events-use the startInteractiveTransition(to:completion:) method to change the layout object. That method installs an intermediate layout object whose purpose is to work with your gesture recognizer or event-handling code to track the transition progress. When your event-handling code determines that the transition is finished, it calls the finishInteractiveTransition() or cancelInteractiveTransition() method to remove the intermediate layout object and install the intended target layout object.

Пікірлер: 3
@nbonsu3510
@nbonsu3510 4 жыл бұрын
What's the point of me paying $35 dollars each month if the video on youtube? it doesn't make sense at all.
@KodecoDev
@KodecoDev 4 жыл бұрын
Every free video on KZfaq should be also free on raywenderlich.com. If you see otherwise, please let us know!
@akshatchaturvedi7407
@akshatchaturvedi7407 2 ай бұрын
😂😂😂
Diffable Data Source (Swift 5, Xcode 12, TableView) - iOS 2020
16:54
1,000 Diamonds! (Funny Minecraft Animation) #shorts #cartoon
00:31
toonz CRAFT
Рет қаралды 40 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:40
CRAZY GREAPA
Рет қаралды 33 МЛН
Finger Heart - Fancy Refill (Inside Out Animation)
00:30
FASH
Рет қаралды 29 МЛН
ЗАБУДЬ про DATASOURCE
44:57
Сергей Горбачёв / cmd+B, cmd+R
Рет қаралды 2,5 М.
Getting Started with Diffable Data Source
8:26
Swift Arcade
Рет қаралды 2,9 М.
UITableViewDiffableDataSource Multi Sections
17:38
Kelvin Fok
Рет қаралды 1,4 М.
Занятие 4: UITableVIew - Diffable datatsource
57:50
Ildar Zalyalov
Рет қаралды 1,5 М.
Diffable Data Source in Multiple Section App (Swift 5)
18:42
SwiftBook
Рет қаралды 10 М.
Collection View Data Prefetching - raywenderlich.com
5:07
Swift API Calls for Beginners (Networking) - Async Await & JSON
25:35
Diffable Data Source | Swift 5, Xcode 11
18:39
Kilo Loco
Рет қаралды 13 М.
1,000 Diamonds! (Funny Minecraft Animation) #shorts #cartoon
00:31
toonz CRAFT
Рет қаралды 40 МЛН