Contents:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| po String.init(data: response.data!, encoding: NSUTF8StringEncoding) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { | |
| let lastSectionIndex = tableView.numberOfSections - 1 | |
| let lastRowIndex = tableView.numberOfRows(inSection: lastSectionIndex) - 1 | |
| if indexPath.section == lastSectionIndex && indexPath.row == lastRowIndex { | |
| // print("this is the last cell") | |
| let spinner = UIActivityIndicatorView(activityIndicatorStyle: .gray) | |
| spinner.startAnimating() | |
| spinner.frame = CGRect(x: CGFloat(0), y: CGFloat(0), width: tableView.bounds.width, height: CGFloat(44)) | |
| self.tableView.tableFooterView = spinner |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // ViewController.swift | |
| // PageViewController | |
| // | |
| // Created by Miguel Fermin on 5/8/17. | |
| // Copyright © 2017 MAF Software LLC. All rights reserved. | |
| // | |
| import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| Scroll to make the the given section header visible. | |
| The function scrollToItemAtIndexPath will scroll to the item and hide the section header. | |
| Swift 3. | |
| */ | |
| func scrollToSection(_ section:Int) { | |
| if let cv = self.collectionView { | |
| let indexPath = IndexPath(item: 1, section: section) | |
| if let attributes = cv.layoutAttributesForSupplementaryElement(ofKind: UICollectionElementKindSectionHeader, at: indexPath) { | |