Skip to content

Instantly share code, notes, and snippets.

View takasurazeem's full-sized avatar
🏠
Working from home

takasurazeem

🏠
Working from home
View GitHub Profile
//------------------------------------------------------------------------
// The SwiftUI Lab: Advanced SwiftUI Animations
// https://swiftui-lab.com/swiftui-animations-part1 (Animating Paths)
// https://swiftui-lab.com/swiftui-animations-part2 (GeometryEffect)
// https://swiftui-lab.com/swiftui-animations-part3 (AnimatableModifier)
//------------------------------------------------------------------------
import SwiftUI
struct ContentView: View {
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
@jeffaburt
jeffaburt / EvenlyWrappedLabel.swift
Created October 10, 2017 00:29
EvenlyWrappedLabel
import UIKit
/**
A UILabel subclass that will vertically distribute text evenly across any
number of lines, preventing text from grouping up at the top.
Example:
(1)
This text: