Skip to content

Instantly share code, notes, and snippets.

View tunds's full-sized avatar

tundsdev tunds

View GitHub Profile
@davidsteppenbeck
davidsteppenbeck / AnimatingMeshView.swift
Created June 11, 2024 16:41
Animating mesh gradient for iOS 18 using TimelineView
import SwiftUI
struct AnimatingMeshView: View {
let referenceDate: Date
var body: some View {
TimelineView(.animation) { context in
let t = context.date.timeIntervalSince(referenceDate)
MeshGradient(width: 5, height: 4, points: [
@chriswebb09
chriswebb09 / ImageDownloadProtocol.swift
Last active September 3, 2019 22:08
Download on Thread
import UIKit
protocol ImageDownloadProtocol {
func downloadImage(from url: URL, completion: @escaping (UIImage?) -> Void)
}
extension ImageDownloadProtocol {
func downloadImage(from url: URL, completion: @escaping (UIImage?) -> Void) {
let session = URLSession(configuration: .default)
DispatchQueue.global(qos: .background).async {