Copy text without storing it in the UIPasteboard history ?

Hello,

To copy some text in the clipboard and be able to paste it in another place, I use this line of code on iOS with Swift :

UIPasteboard.general.string = "My text here"

I also want to clear the clipboard after a duration, so I updated my code to :

UIPasteboard.general.setItems([[UTType.plainText.identifier: "My text here"]], options: [.expirationDate: Date(timeIntervalSinceNow: 60)])

Both those code are working fine but I tried to do something as secure as possible and by trying password manager application (like 1Password for example), I saw that I can copy my password and paste it, but the password is not store in the clipboard history (I'm using "Paste" to be able to see my clipboard history).

I didn't see anything about this in the Apple documentation. So, how those password managers are able to do this?

I know it is possible to use a custom UIPasteboard but it means that the clipboard is only available in my others applications and I want to be able to paste the text everywhere (depending on user choice). So that's probably not an option for me.

Any idea ?

Thanks,

Alexandre

Copy text without storing it in the UIPasteboard history ?
 
 
Q