Skip to content

Instantly share code, notes, and snippets.

View MaherKSantina's full-sized avatar
🎯
Focusing

Maher Santina MaherKSantina

🎯
Focusing
  • New South Wales, Australia
View GitHub Profile
@MaherKSantina
MaherKSantina / snippet.swift
Created July 24, 2018 08:25
MSPCVDI Snippet 3
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
return 0
}
@MaherKSantina
MaherKSantina / snippet.swift
Created July 24, 2018 08:24
MSPCVDI Snippet 2
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let itemWidth = max(0, collectionView.frame.size.width - 2 * (cellSpacing + cellPeekWidth))
return CGSize(width: itemWidth, height: collectionView.frame.size.height)
}
@MaherKSantina
MaherKSantina / snippet.swift
Created July 24, 2018 08:22
MSPCVDI Snippet 1
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
let leftAndRightInsets = cellSpacing + cellPeekWidth
return UIEdgeInsets(top: 0, left: leftAndRightInsets, bottom: 0, right: leftAndRightInsets)
}
@MaherKSantina
MaherKSantina / snippet.swift
Last active July 24, 2018 08:19
MSPCVDI Complete Example
import UIKit
import MSPeekCollectionViewDelegateImplementation
class ViewController: UIViewController {
@IBOutlet weak var collectionView: UICollectionView!
let delegate = MSPeekCollectionViewDelegateImplementation()
override func viewDidLoad() {
super.viewDidLoad()