Skip to content

Instantly share code, notes, and snippets.

View vipulRajput's full-sized avatar

Vipul Kumar vipulRajput

  • India
View GitHub Profile
@hcn1519
hcn1519 / GradientLayer.md
Last active June 7, 2023 09:33
UITableViewCell with GradientLayer in swift

Create GradientLayer on your tableViewCell(collectionViewCell)

1. Create CAGradientLayer Instance on your tableViewCell

class MyCell: UITableViewCell {
    let gradientLayer = CAGradientLayer()
}
@benjaminsnorris
benjaminsnorris / CollectionViewController.swift
Created March 10, 2016 03:00
Snap to center collection view cell
class CollectionViewController: UIViewController {
...
func snapToCenter() {
let centerPoint = view.convertPoint(view.center, toView: collectionView)
guard let centerIndexPath = collectionView.indexPathForItemAtPoint(centerPoint)
collectionView.scrollToItemAtIndexPath(centerIndexPath, atScrollPosition: .CenteredHorizontally, animated: true)
}
...
}