class SearchViewController: UIViewController, UISearchBarDelegate {
// We keep track of the pending work item as a property
private var pendingRequestWorkItem: DispatchWorkItem?
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
// Cancel the currently pending item
pendingRequestWorkItem?.cancel()
// Wrap our request in a work item
let requestWorkItem = DispatchWorkItem { [weak self] in
self?.resultsLoader.loadResults(forQuery: searchText)
}
// Save the new work item and execute it after 250 ms
pendingRequestWorkItem = requestWorkItem
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(250),
execute: requestWorkItem)
}
}
// Written by John sundell https://www.swiftbysundell.com/posts/a-deep-dive-into-grand-central-dispatch-in-swift
I'll use port 9005 instead standard 9000 to avoid conflicts with other applications.
Client Side (Host with Atom):
1) Download php-debug
2) Configure php-debug : Server: 10.254.254.254 - Port: 9005 - Pathmaps : add "/" at the end of path to include all subfolders
3) Enable php-debug panel inside Atom with CTRL+ALT+D (or clicking bottom left button "PHP Debug"
4) Make lo0 alias: ifconfig lo0 alias 10.254.254.254
Server Side (Server inside Docker):
Xdebug configuration:
;zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_connect_back=0
xdebug.remove_host=10.254.254.254
xdebug.remote_port=9005
xdebug.remote_log=/tmp/xdebug.log
The value of the left posiont is the Px size form the beginning of the margin on the current element to
the beginning of the padding on the parent element.
the property returns the left position(includes the margin) relative to the left side(at the beginning of the padding)
of the parent element