Query whereKey EqualTo with objectId String not the PFObject

When issuing:

query.whereKey("UserPointer", equalTo: singleUser)

This requires me to have the singleUser variable pre-populated with a PFUser object.

Is it possible to change the query so that it would work with the same PFUser’s objectId as a String value?

I know if singleUser is populated, I could do singleUser.objectId to get this string value, but the Key is expecting an object, not a string.

You can do like this:

query.whereKey("UserPointer", equalTo: PFObject(withoutDataWithClassName: "User", objectId: "objectid_goes_gere"))