Safari app extension: SFSafariPageProperties URL is nil

I have a Safari app extension that needs to know the url of the current active tab. When I press a button, a function in SafariExtensionViewController gets called with the following code:


let safari = SFSafariPageProperties()
let currentURL = safari.url



But currentURL is nil. Not sure what I'm doing wrong? The extension is for mac. Safari 14, macOS 11.1
Safari app extension: SFSafariPageProperties URL is nil
 
 
Q