Skip to content

Instantly share code, notes, and snippets.

Avatar

Jayesh Kawli jayesh15111988

View GitHub Profile
View virusOriginator.swift
let graphNodes = [(1, 2), (2, 3), (2, 4), (4, 5), (4, 6), (5, 4)]
var nodeToIncomingEdgesCountMapping: [Int: Int] = [:]
for node in graphNodes {
if nodeToIncomingEdgesCountMapping[node.0] == nil {
nodeToIncomingEdgesCountMapping[node.0] = 0
}
if nodeToIncomingEdgesCountMapping[node.1] == nil {
@jayesh15111988
jayesh15111988 / ImageDownloader.swift
Created Apr 26, 2020
A gist for image downloader and caching library written in Swift for iOS applications
View ImageDownloader.swift
import UIKit
// Image downloader utility class. We are going to use the singleton instance to be able to download required images and store them into in-memory cache.
final class ImageDownloader {
static let shared = ImageDownloader()
private var cachedImages: [String: UIImage]
private var imagesDownloadTasks: [String: URLSessionDataTask]
View MovieCell.swift
//
// MovieCell.swift
//
import UIKit
final class MovieCell: UITableViewCell {
let posterImageView = UIImageView(frame: .zero)