How can I change the text to copy link when the item being shared is a link
I am tried this but it does not work as expected
@objc(CustomUIActivity)
class CustomUIActivity: UIActivity {
private var url = NSURL()
override class var activityCategory: UIActivity.Category {
return .share
}
override var activityType: UIActivity.ActivityType? {
return .customuiactivity
}
override var activityTitle: String? {
return "Copy Link"
}
override var activityImage: UIImage? {
return UIImage(named: "icon-copy")
}
override func canPerform(withActivityItems activityItems: [Any]) -> Bool {
for activityItem in activityItems {
if let _ = activityItem as? NSURL {
return true
}
}
return false
}
var textToShare: String?
override func prepare(withActivityItems activityItems: [Any]) {
for activityItem in activityItems {
if let url = activityItem as? NSURL {
self.url = url
}
}
}
override func perform() {
// perform your custom activity
UIPasteboard.general.string = url.absoluteString
activityDidFinish(true)
}
}
extension UIActivity.ActivityType {
static let customuiactivity =
UIActivity.ActivityType("com.productHunt.copyLink")
}

Here I have attached screenshot what I have expected
