Skip to content

Instantly share code, notes, and snippets.

View twzurkan's full-sized avatar

twzurkan

View GitHub Profile
@twzurkan
twzurkan / loadPhoto.swift
Last active July 25, 2023 18:58
WithAndWithoutTask
self.photo.clipsToBounds = true
if let img = employee.photoUrlSmall {
ImageLoader.getEmployeeImage(img: img) { [weak self] data, err in
if let data = data {
DispatchQueue.main.async {
self?.photo.image = UIImage(data: data)
}
}
else {
DispatchQueue.main.async {
@twzurkan
twzurkan / Heap.swift
Last active March 17, 2024 21:26
Swift Heap/PriorityQueue
/// This is a simple Heap implementation which can be used as a priority queue.
class Heap<T:Comparable> {
typealias HeapComparator<T:Comparable> = (_ l:T,_ r:T) -> Bool
var heap = [T]()
var count:Int {
get {
heap.count
}
}