I have achieved it this way. Add the following code to your AppDelegate doneFinishLaunchingWithOptions
OneSignal.inFocusDisplayType = OSNotificationDisplayType.none
on the last line in
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { OneSignal.inFocusDisplayType = OSNotificationDisplayType.none return true }
we have these 3 options
public enum OSNotificationDisplayType : UInt { case none case inAppAlert case notification }
Here's the OneSignal Documentation
source share