[Xcode/Swift] 文字列をコピーする方法 (UIPasteboard)

import SwiftUI

struct HomeView: View {
    @State private var copyPasteString: String = ""

    var body: some View {
        VStack {
            TextField("Copy and Paste", text: $copyPasteString)
                .textFieldStyle(RoundedBorderTextFieldStyle())
                .padding()
            
            Button(action: {
                // TextFieldの入力内容をコピー
                UIPasteboard.general.string = copyPasteString
            }) {
                Text("Copy")
            }
        }
    }
}