Make a new SwiftUI app in Xcode and customise the AccentColor in the Assets catalog to pink.
Run the app and see the accent colour is pink
Add PostHog as a Swift package to the project.
Add an init to the top-level App struct with the following code:
PHGPostHog(configuration: .init(apiKey: ""))
Run the app again. Notice that the accent colour is now blue.
The fix is the same as Sentry implemented and stop using the now deprecated UIScreen.main. The simplest solution if there isn't access to an actual view is to do this via UIApplication's windows property.
Similar to https://github.com/getsentry/sentry-cocoa/issues/2741, there is an issue when using PostHog in a SwiftUI app. Steps to reproduce:
App
struct with the following code:PHGPostHog(configuration: .init(apiKey: ""))
The fix is the same as Sentry implemented and stop using the now deprecated
UIScreen.main
. The simplest solution if there isn't access to an actual view is to do this via UIApplication'swindows
property.