File: uicollectionviewdatasource

package info (click to toggle)
yasnippet-snippets 1.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,328 kB
  • sloc: lisp: 127; sh: 13; ada: 5; makefile: 2; python: 2
file content (37 lines) | stat: -rw-r--r-- 1,200 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -*- mode: snippet -*-
# name: uicollectionViewDataSource
# key: uicollectionViewDataSource
# --
// MARK: UICollectionViewDataSource

func numberOfSections(in collectionView: UICollectionView) -> Int {
    return $1
}

func collectionView(_ collectionView: UICollectionView,
      numberOfItemsInSection section: Int) -> Int {
    // TODO:- Required Method
    return $2
}

func collectionView(_ collectionView: UICollectionView,
             cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    let cell =
        collectionView.dequeueReusableCell(withReuseIdentifier: $3, for: indexPath)
    configureCell(cell: cell, forItemAt: indexPath)
    // TODO:- Required Method
    return cell
}

func configureCell(cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {

}

func collectionView(_ collectionView: UICollectionView,
    viewForSupplementaryElementOfKind kind: String,
                              at indexPath: IndexPath) -> UICollectionReusableView {
    let view = collectionView.dequeueReusableSupplementaryView(
                   ofKind: UICollectionElementKindSectionHeader,
                   withReuseIdentifier: $3, for: indexPath) as UIView
    return view
}