Skip to content

Instantly share code, notes, and snippets.

View AppsTitude's full-sized avatar

Louis Encontre AppsTitude

View GitHub Profile
@AppsTitude
AppsTitude / UICollection and NSFetchedResultsControllerDelegate integration.swift
Last active September 17, 2022 11:25
UICollectionView and NSFetchedResultsControllerDelegate integration in Swift
// I just implemented that with Swift. So I would like to share my implementation.
// First initialise an array of NSBlockOperations:
var blockOperations: [NSBlockOperation] = []
// In the did change object method:
func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) {
if type == NSFetchedResultsChangeType.Insert {
println("Insert Object: \(newIndexPath)")
protocol ViewModelInputs {
var buttonTapped: AnyObserver<Void> { get }
}
protocol ViewModelOutputs {
var showLoginErrorMessage: Driver<String> { get }
}
protocol ViewModelIO {
var inputs: ViewModelInputs { get }