You could implement a notification service extension to receive the push notifications, and request from Apple that they grant your app the com.apple.developer.usernotifications.filtering entitlement.
Set up a shared group between the app and the extension (i.e. to house shared defaults). When the user toggles on/off the switch the app writes that to the group defaults. When the extension receives a push, the extension reads the toggle switch setting from shared defaults and if the user has turned them off then the entitlement will enable the extension to suppress the displaying of the notification.
Topic:
App & System Services
SubTopic:
Notifications
Tags: