Skip to content

Instantly share code, notes, and snippets.

View dancarvajc's full-sized avatar

Daniel Carvajal dancarvajc

View GitHub Profile
@atierian
atierian / README.md
Last active July 30, 2025 03:41
Allow consumers of SwiftUI UIViewRepresentable conforming Views to inject wrapped UIView delegate implementations through ViewModifiers using a ProxyDelegate.

Allow the consumer of a SwiftUI UIViewRepresentable View to inject delegate implementations for the wrapped UIView through View Modifiers by using a proxy delegate.

This can be a helpful pattern when providing a SwiftUI wrapper for a very heavy and complex UIView, where the wrapper implements many of the delegate methods of the wrapped UIView. But you want someone consuming the wrapper to have the ability to inject their own delegate method implementations to override yours, or to leverage some of the methods your not implementing.

@VAnsimov
VAnsimov / HostingView Example.swift
Last active March 19, 2025 16:34
SwiftUI View to UIView
import UIKit
import SwiftUI
// SwiftUI
struct SomeView: View {
var body: some View {
Text("Hello World!")
}
}