in swiftui, make an app that capture the current selected text to clipboard, and then…
- User
in swiftui, make an app that capture the current selected text to clipboard, and then uppercase this text and then set clipboard to this text
Assistant
Here is SwiftUI code to capture the selected text to the clipboard, uppercase it, and set the clipboard to the uppercased text:
import SwiftUI struct ContentView: View { @State private var selectedText = "" var body: some View { Text("Hello World") .background( TextReceiver() .onReceiveText { text in self.selectedText = text UIPasteboard.general.string = text.uppercased() } ) } } struct TextReceiver: UIViewRepresentable { func makeUIView(context: Context) -> UITextView { let textView = UITextView() textView.isSelectable = true textView.isUserInteractionEnabled = true return textView } func updateUIView(_ uiView: UITextView, context: Context) {} typealias UIViewType = UITextView }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.