I am trying to get the url of an image in my assets folder to use it as the preview for a UIActivityViewController as suggested here. However I am getting nil for the path, even though the UIImage is working. I have checked if the extension is lowercase as suggested in another question and it is indeed. I have also tried using .path
Bundle.main.url(forResource: "emoji-2", withExtension: "jpg") // this is nil
UIImage(named: "emoji-2") // this is not nil
Any ideas what I'm doing wrong?