SHORT QUESTIONS

How i will copy text in swiftui?

@State var copiedText: String = \"\" private let pastboard = UIPasteboard.general var body: some View { TextField(\"This is plceholdr\", text: $myText) .border(.red).pad...

J
Joynal Abedin
4
    @State var copiedText: String = \"\"
    private let pastboard = UIPasteboard.general
    
    var body: some View {
        
        
        TextField(\"This is plceholdr\", text: $myText)
            .border(.red).padding()
        
        
        Button {
            pastboard.string = copiedText
        } label: {
            Label(\"Copy to Clipboard\", systemImage: \"doc.on.doc\")
        }
    }
J

Written by Joynal Abedin

Passionate about technology, code, and sharing knowledge.

0 Comments

Leave a Comment