54 lines
1.2 KiB
Swift
54 lines
1.2 KiB
Swift
//
|
|
// ContentView.swift
|
|
// CatalystEmojiTest
|
|
//
|
|
// Created by Shadowfacts on 4/3/23.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct ContentView: View {
|
|
@State private var text = ""
|
|
|
|
var body: some View {
|
|
NavigationStack {
|
|
TextEditor(text: $text)
|
|
.toolbar {
|
|
// try commenting this ToolbarItem out:
|
|
ToolbarItem(placement: .confirmationAction) {
|
|
Button("OK") {}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
struct TestWrappedTextView: UIViewRepresentable {
|
|
@Binding var text: String
|
|
|
|
func makeUIView(context: Context) -> UITextView {
|
|
let v = UITextView()
|
|
v.delegate = context.coordinator
|
|
return v
|
|
}
|
|
|
|
func updateUIView(_ uiView: UITextView, context: Context) {
|
|
}
|
|
|
|
func makeCoordinator() -> Coordinator {
|
|
Coordinator(binding: $text)
|
|
}
|
|
|
|
class Coordinator: NSObject, UITextViewDelegate {
|
|
let binding: Binding<String>
|
|
|
|
init(binding: Binding<String>) {
|
|
self.binding = binding
|
|
}
|
|
|
|
func textViewDidChange(_ textView: UITextView) {
|
|
binding.wrappedValue = textView.text
|
|
}
|
|
}
|
|
}
|