Skip to content

Instantly share code, notes, and snippets.

Joseph Slinker jslinker

Block or report user

Report or block jslinker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jslinker / SampleFlowLayout.swift
Created Jan 14, 2019
UICollectionViewControllerFlowLayout boiler plate. Just fill out the `prepare` function with you layout logic and the rest just works.
View SampleFlowLayout.swift
class SampleFlowLayout: UICollectionViewLayout {
override func prepare() {
guard let collectionView = self.collectionView else { return }
// go through every section..
for section in 0..<collectionView.numberOfSections {
let numberOfItems = collectionView.numberOfItems(inSection: section)
View gist:782208045b4cbe98ad60
data = { item -> (t, CGFloat) in
var score: CGFloat!
autoreleasepool {
score = self.converter(item).scoreAgainst(string)
return (item, score)
.filter { return $0.1 > CGFloat(0) }
.sorted { return $0.1 > $1.1 }
.map { return $0.0 }
You can’t perform that action at this time.