Access the UserDefaults from the safari extension background page

Hi, I am working on safari web extension for iOS, Since Message passing is only supported from safari extension to iOS application.

To pass the data from app to safari extension, I thought of storing the required data using the Userdefault suite name and "app group" to access the UserDefaults data from the safari extension.

I am stuck at how to access the data at the safari extension. Any sample javascript to access the UserDefaults data is appreciated

Thanks