Answer the question
In order to leave comments, you need to log in
How to properly implement UIPasteboard.general.string + actionSheet?
Greetings friends
Need advice
1. In AppDelegate in func applicationDidBecomeActive(_ application: UIApplication) - there is a method that constantly checks what is in UIPasteboard.general.string, and if there is not a correct link, then actionSheet
2 appears to the user. But there was a moment, how to make it so that after clicking on cancel in the actionsheet, it no longer appears on the same link? Since leaving the application, the user may return with a new link in the buffer, or maybe with the same one that was.
3. So far I have found a "crutch" solution, but I want to hear the tips of professionals
Answer the question
In order to leave comments, you need to log in
very easy :) whitelist the links:
1. Set up a simple Set that is stored in your AppDelegate instance
2. For the UIAlertAction that corresponds to the cancel button, add an action:
3.Before showing the UIAlertController, check the white list:
guard !whiteList.contains(link) else {
return
}
let alertController = ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question