Skip to content

Instantly share code, notes, and snippets.

View fl034's full-sized avatar
💬

Frank Lehmann fl034

💬
View GitHub Profile
@fl034
fl034 / doubleTapZoom
Last active March 4, 2025 10:32 — forked from gunantosteven/doubleTapZoom
Double Tap Zoom to The Tap Location Swift 5 iOS 13
@objc func handleDoubleTap(_ recognizer: UITapGestureRecognizer) {
let scale = min(scrollView.zoomScale * 2, scrollView.maximumZoomScale)
if scrollView.zoomScale == scrollView.minimumZoomScale { // zoom in
let point = recognizer.location(in: imageView)
let scrollSize = scrollView.frame.size
let zoomScale = scrollView.maximumZoomScale * 0.7
let size = CGSize(width: scrollSize.width / zoomScale,
height: scrollSize.height / zoomScale)
@fl034
fl034 / RatioBasedImageView.swift
Last active September 24, 2019 09:04 — forked from algal/ScaleAspectFitImageView.swift
UIImageView subclass that works with Auto Layout to express its desired aspect ratio
import UIKit
// known-good: Xcode 8.2.1
/**
UIImageView subclass which works with Auto Layout to try
to maintain the same aspect ratio as the image it displays.
This is unlike the usual behavior of UIImageView, where the
scaleAspectFit content mode only affects what the view displays