Skip to content

Instantly share code, notes, and snippets.

View ZoomableImageView.swift
import Foundation
import UIKit
import SwiftUI
// Reference: https://tinyurl.com/y2aamlqd and https://tinyurl.com/y62jzxsv
struct ZoomableImageView: UIViewRepresentable {
var image: UIImage
View BindGeometry.swift
import Foundation
import SwiftUI
extension View {
func bindGeometry(size: Binding<CGSize>? = nil, safeAreaInsets: Binding<EdgeInsets>? = nil) -> some View {
let id = UUID()
return self.background(GemoetryProxyBinding.View(id: id))
.onPreferenceChange(GemoetryProxyBinding.PreferenceKey.self) { preferences in
View SwiftUIColorExtension.swift
import Foundation
import SwiftUI
extension Color {
static let clear = Color(UIColor.clear)
static let systemGray = Color(UIColor.systemGray)
static let systemGray2 = Color(UIColor.systemGray2)
static let systemGray3 = Color(UIColor.systemGray3)
static let systemGray4 = Color(UIColor.systemGray4)
View CStringArray
/*
Creates an array of C-strings that can be passed to C functions and automatically deallocated
Copyright 2020 Robert Salesas
*/
public struct CStringArray {
public let pointer: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>
public let count: Int
private var data: Data
You can’t perform that action at this time.