Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alert documentation is confusing #244

Open
waterskier2007 opened this issue May 2, 2023 · 3 comments
Open

Alert documentation is confusing #244

waterskier2007 opened this issue May 2, 2023 · 3 comments

Comments

@waterskier2007
Copy link

The documentation at https://github.com/nalexn/ViewInspector/blob/master/guide_popups.md#alert is confusing. Specifically for alerts it states If you're using alert functions added in iOS 15 (those not marked as deprecated) - you're good to go. and then states that only if you are NOT using those functions you will need to add the shim code. However errors in unit tests direct back to the documentation even if the alert functions > iOS 15 are being used. I think this documentation could be clarified as to WHEN the shim code is needed and how a test should be written if the shim code is NOT needed.

@lo1tuma
Copy link

lo1tuma commented May 2, 2023

I’m also quite confused when reading the guide about popups. Why is alert different than the other popups like sheet? Why is it possible to use the iOS 15 alert functions without a shim but the sheet modifier still requires the shim?

@nalexn
Copy link
Owner

nalexn commented May 2, 2023

Alerts and sheets look similar from the public APIs, both in swiftUI and in view inspector (at least, I aim to align the APIs), but under the hood, there are sometimes dramatic differences in inner structure and workings. Apple's engineers have revamped the implementation of Alerts several times (they usually don't do that with the other swiftui views), if you look at the code in the library you'll see all the branching based on the OS versions. I will double check the docs for actuality though, thanks for the heads up

@lo1tuma
Copy link

lo1tuma commented May 3, 2023

@nalexn thanks for the explanation. I wasn’t aware of that, since also the SwiftUI of alert() and sheet() looks very similar. Maybe that would be also noteworthy in the documentation, to explain why some presentation modifiers need a shim and some don’t. I think especially the first sentence in the section about sheet is a bit confusing "Similarly to the Alert and ActionSheet" give the impression the non-shim solution could also work for sheet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants