Skip to content

Instantly share code, notes, and snippets.

View takasurazeem's full-sized avatar
Working from home


Working from home
View GitHub Profile
// The SwiftUI Lab: Advanced SwiftUI Animations
// (Animating Paths)
// (GeometryEffect)
// (AnimatableModifier)
import SwiftUI
struct ContentView: View {
jeffaburt / EvenlyWrappedLabel.swift
Created October 10, 2017 00:29
import UIKit
A UILabel subclass that will vertically distribute text evenly across any
number of lines, preventing text from grouping up at the top.
This text:
extension UIImageView {
/// Loads image from web asynchronosly and caches it, in case you have to load url
/// again, it will be loaded from cache if available
func load(url: URL, placeholder: UIImage?, cache: URLCache? = nil) {
let cache = cache ?? URLCache.shared
let request = URLRequest(url: url)
if let data = cache.cachedResponse(for: request)?.data, let image = UIImage(data: data) {
self.image = image
} else {
self.image = placeholder