Skip to content

Instantly share code, notes, and snippets.

struct ContentView: View {
@State var urlString = "https://www.google.com"
@State var url: URL?
var body: some View {
NavigationStack {
WebViewReader { proxy in
Webview(url: url ?? URL(string: "https://www.google.com")!)
@drucelweisse
drucelweisse / example.swift
Last active March 27, 2025 16:10
SwiftUI UIViewRepresentable Example
final class UIKitTextField: UITextField {}
final class Box<T> {
var value: T
init(_ value: T) {
self.value = value
}
}
@drucelweisse
drucelweisse / CustomTextFieldStyle.swift
Created January 24, 2022 22:18
SwiftUI CustomTextFieldStyle example
import SwiftUI
typealias CustomTextFieldStyle = ViewModifier
extension View {
func customTextFieldStyle<S>(_ style: S) -> some View where S: CustomTextFieldStyle {
modifier(style)
}
}
@drucelweisse
drucelweisse / ContentView.swift
Created October 3, 2021 17:13
iOS 15 sheet, fullscreen bug
import SwiftUI
struct ContentView: View {
enum Sheet: String, Identifiable {
var id: String {
rawValue
}