Using ASCredentialProviderViewController to only autofill the password

Hello,

I'm in the process of creating a credential provider app that is supposed to only autofill the password field and leaves the username field untouched.


To that end, I create a subclass of ASCredentialProviderViewController and make the following call to complete an autofill request:


self.extensionContext.completeRequest(withSelectedCredential: passwordCredential, completionHandler: ni


Since the user field of passwordCredential cannot be null, I create the passwordCredential as follows:


let passwordCredential = ASPasswordCredential(user: "", password: "my password")


This works as expected when using my app in safari to autofill a password on a web site. As intended, it does not interfere with an already filled in username. However, if I use my autofill extension to autofill a password in a native app, the username is cleared when my extension executes self.extensionContext.completeRequest.


Is there another, prefered, way to only autofill a password?

If not, how could I access the username from the native app, such that I can use it to create an ASPasswordCredential object with a user name?


Thanks in advance for your help!