Skip to content

Instantly share code, notes, and snippets.

@SlappyAUS
SlappyAUS / timer.swift
Last active October 9, 2020 23:50
Timer with Closure #util
Timer.scheduledTimer(withTimeInterval: interval, repeats: false) { (timer) in
// Code here
}
@SlappyAUS
SlappyAUS / UpdateUI.swift
Last active October 9, 2020 23:50
Update UI on Main Thread #ui
DispatchQueue.main.async {
// Update UI components here
}
@SlappyAUS
SlappyAUS / httpRequest.swift
Last active October 9, 2020 23:50
HTTP Request - Making Request #network #http
// Apply Delegate to the UIViewController
protocol CoinManagerDelegate {
func didUpdateData(_ sender: CoinManager, parsedData: BitcoinData)
func didFailWithError(_ sender: CoinManager, error: Error)
}
// Insert these calls into the component making the call (Manager class)
func performRequest(with urlString: String) {
let url = URL(string: urlString)