我不想写这个链接“https://stackoverflow.com/questions/ask”,如此行所示。我希望网址从剪贴板接收最后复制的网址,我应该添加什么?
let url = URL(string: "https://stackoverflow.com/questions/ask")
答案 0 :(得分:4)
复制强>
let url = URL(string: "https://stackoverflow.com/questions/ask")
UIPasteboard.general.string = url
<强>粘贴强>
if let url = UIPasteboard.general.string {
url = url
}