Skip to content

Instantly share code, notes, and snippets.

View ambas's full-sized avatar
🤔
🥺

Ambas Chobsanti ambas

🤔
🥺
View GitHub Profile
@ambas
ambas / public key
Last active November 14, 2017 11:07
for generate public key
ssh-keygen -t rsa -C "ambaschobsanti@gmail.com" && pbcopy < ~/.ssh/id_rsa.pub
We couldn’t find that file to show.
This is Brazil
Podfile
Podfile.lock
Pods
Resources
Scripts
TWMappingKit
TaskKit
TaskKitTests
TaskReactiveKit
TaskReactiveKitTests
sed -i '' 's/nullable//g' $(grep -lr --exclude-dir=".git" -e "nullable" .)
sed -i '' 's/nullable//g' $(grep -lr --exclude-dir=".git" -e "nullable" .)
@ambas
ambas / gist:dd5240e3b843d6608990
Last active August 29, 2015 14:25
FetechedResultsController for TableView
- (void)controllerWillChangeContent {
[self.tableView beginUpdates];
}
- (void)controllerDidChangeSection:(RBQFetchedResultsSectionInfo *)section atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type {
switch (type) {
case NSFetchedResultsChangeInsert:
[self.insertSections addObject:@(sectionIndex)];
break;
case NSFetchedResultsChangeDelete:
extension Dictionary {
mutating func merge<S>(_ other: S) where S: Sequence, S.Iterator.Element == (key: Key, value: Value) {
for (k, v) in other {
let old = self[k]
self[k] = merge(old, r: v)
}
}
}
extension Dictionary {
  • Start with Classes -> Modules -> Cart -> Section

  • In this folder you can see all section type that we have in cart. ( PS. LACartSection is legacy class)

  • I use IGListBindingSectionController for SectionController with this way it will automatically bind viewModel and cell for us.

  • in sectionController class, we have to implement some dataSource methods

    • First we need to return all viewModel for section
    • Each viewModel will map to cell so relationship for viewModel and cell will be 1 to 1. So its mean a viewModel will have a cell to show.
    • I use category to separate logic for build viewModels , for the final result we will return array of viewModel to IGListKit and all of this viewModel will be mapped to cell.
    • You can check category in folder Classes -> Modules -> Cart -> Categories
  • If you start reading code at sectionController you will see category of viewModel try to ask a list of viewModel from child viewModel . I use this way because I try to separate viewModel bui