This breakpoint provides an easy way to track view controller deinitialization (deallocation) in UIKit-based applications. This can help finding memory leaks caused by retain cycles preventing view controllers from being deinitialized when dismissed or popped.
From Cédric Luthi's tweet in 2017:
Useful Xcode breakpoint. When you dismiss a controller and you don’t hear the pop sound (or see the log), you probably have a retain cycle.
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
#!/usr/bin/env bash | |
# Author: @11808s8 - Adriano | |
# Email: [email protected] | |
# Version: 1.1.0 - 07/04/2020 | |
# | |
# @TODO: Refactor this, breaking parts into modules | |
# and include more comments/User feedbacks | |
# | |
# @TODO: Remove hardcoded credentials |
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
class PageViewController: UIPageViewController { | |
override func setViewControllers(_ viewControllers: [UIViewController]?, direction: UIPageViewController.NavigationDirection, animated: Bool, completion: ((Bool) -> Void)? = nil) { | |
super.setViewControllers(viewControllers, direction: direction, animated: animated) { (isFinished) in | |
if isFinished && animated { | |
DispatchQueue.main.async { | |
super.setViewControllers(viewControllers, direction: direction, animated: false, completion: nil) | |
} | |
} | |
completion?(isFinished) |
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
// based on http://stackoverflow.com/questions/13017257/how-do-you-determine-spacing-between-cells-in-uicollectionview-flowlayout https://github.com/mokagio/UICollectionViewLeftAlignedLayout | |
import UIKit | |
extension UICollectionViewLayoutAttributes { | |
func leftAlignFrame(with sectionInset:UIEdgeInsets){ | |
var tempFrame = frame | |
tempFrame.origin.x = sectionInset.left | |
frame = tempFrame | |
} | |
} |
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
for (key, value) in UserDefaults.standard.dictionaryRepresentation() { | |
print("\(key) = \(value) \n") | |
} |
#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.
Run the following commands in sequence.
sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
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
// for multiple requests | |
let isRefreshing = false; | |
let failedQueue = []; | |
const processQueue = (error, token = null) => { | |
failedQueue.forEach(prom => { | |
if (error) { | |
prom.reject(error); | |
} else { | |
prom.resolve(token); |
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
/** | |
* Used as a wrapper for data that is exposed via a LiveData that represents an event. | |
*/ | |
open class Event<out T>(private val content: T) { | |
var hasBeenHandled = false | |
private set // Allow external read but not write | |
/** | |
* Returns the content and prevents its use again. |
NewerOlder