create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
| func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { | |
| if indexPath.row + 1 == list.count { | |
| if currentPage != totalPage{ | |
| self.getList(currentPage + 1, max_row) | |
| } | |
| } | |
| } |
| ## Build generated | |
| build/ | |
| DerivedData | |
| build.xcarchive | |
| ## Various settings | |
| *.pbxuser | |
| !default.pbxuser | |
| *.mode1v3 | |
| !default.mode1v3 |
| //Swift 4.1 | |
| func moveToSection(section:Int){ | |
| if let sec = self.collectionView?.numberOfSections{ | |
| if sec > section{ | |
| let indexP = IndexPath(item: 0, section: section) | |
| if let cv = self.collectionView{ | |
| if section == 0{ | |
| cv.scrollToItem(at: indexP, at: .centeredVertically, animated: true) |
| let cell = collectionView.cellForItem(at: indexPath) | |
| UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 5, options: [], | |
| animations: { | |
| cell!.transform = CGAffineTransform(scaleX: 0.9, y: 0.9) | |
| }, | |
| completion: { finished in | |
| UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 5, options: .curveEaseInOut, | |
| animations: { |
| /** | |
| 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) { | |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
| let albumsPhoto:PHFetchResult<PHAssetCollection> = PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .albumRegular, options: nil) | |
| albumsPhoto.enumerateObjects({(collection, index, object) in | |
| if collection.localizedTitle == "Screenshots"{ | |
| let photoInAlbum = PHAsset.fetchAssets(in: collection, options: nil) | |
| print(photoInAlbum.count) //Screenshots albums count | |
| } | |
| }) |
| func getAssetThumbnail(asset: PHAsset, size: CGFloat) -> UIImage { | |
| let retinaScale = UIScreen.main.scale | |
| let retinaSquare = CGSize(width: size * retinaScale, height: size * retinaScale)//(size * retinaScale, size * retinaScale) | |
| let cropSizeLength = min(asset.pixelWidth, asset.pixelHeight) | |
| let square = CGRect(x:0, y: 0,width: CGFloat(cropSizeLength),height: CGFloat(cropSizeLength)) | |
| let cropRect = square.applying(CGAffineTransform(scaleX: 1.0/CGFloat(asset.pixelWidth), y: 1.0/CGFloat(asset.pixelHeight))) | |
| let manager = PHImageManager.default() | |
| let options = PHImageRequestOptions() | |
| var thumbnail = UIImage() | |
| options.isSynchronous = true |
| @discardableResult | |
| func customActivityIndicatory(_ viewContainer: UIView, startAnimate:Bool? = true) -> UIActivityIndicatorView { | |
| let mainContainer: UIView = UIView(frame: viewContainer.frame) | |
| mainContainer.center = viewContainer.center | |
| mainContainer.backgroundColor = UIColor.init(netHex: 0xFFFFFF) | |
| mainContainer.alpha = 0.5 | |
| mainContainer.tag = 789456123 | |
| mainContainer.isUserInteractionEnabled = false | |
| let viewBackgroundLoading: UIView = UIView(frame: CGRect(x:0,y: 0,width: 80,height: 80)) |