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
private var searchTimer: Timer? | |
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { | |
if let searchTimer = searchTimer { | |
searchTimer.invalidate() | |
} | |
searchTimer = Timer.scheduledTimer(timeInterval: 0.4, target: self, selector: #selector(self.reload(timer:)), userInfo: searchText, repeats: false) | |
} | |
func reload(timer: Timer) { |
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
import Foundation | |
import UIKit | |
protocol DownloadAccountProtocol { | |
func downloadAccount(with name: String, completion: (Person) -> ()) | |
} | |
class ServerDownloader: DownloadAccountProtocol { | |
func downloadAccount(with name: String, completion: (Person) -> ()) { | |
let personDictionary: [String: String] = [:] // Dictionary JSON downloaded from server |
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
<html> | |
<body style='margin:0px;padding:0px;'> | |
<script type='text/javascript' src='http://www.youtube.com/iframe_api'></script> | |
<script type='text/javascript'> | |
var ytplayer; | |
function timeElapsed() { | |
return Math.floor(ytplayer.getCurrentTime()) | |
} |
NewerOlder