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

Allow swipe back for in-app safari #45

Merged
merged 4 commits into from
Sep 14, 2021
Merged

Allow swipe back for in-app safari #45

merged 4 commits into from
Sep 14, 2021

Conversation

twodayslate
Copy link
Owner

@twodayslate twodayslate commented Sep 6, 2021

Closes #44

For some reason when you swipe to go back when the story is in a sheet (similar testing to #22 and #26) the story disappears. If you use the close button it doesn't. If I print the onDismiss that also get's called twice (sounds like something similar to stleamist/BetterSafariView#15 although I don't know the fix). If I try to put SafariView on ContentView I get similar bugs to #26. This could be #21 but I don't understand why it would be fine for the close button but not swipe.

Other research for this ticket:

@twodayslate
Copy link
Owner Author

twodayslate commented Sep 9, 2021

Perhaps the story gets deallocated and the state changes - since the sheet doesn't have a reload button there is no way to refresh the page. Might need to check if the story is loaded at didAppear

edit: The story fetcher is getting deallocated

@twodayslate
Copy link
Owner Author

@twodayslate
Copy link
Owner Author

twodayslate commented Sep 11, 2021

It was actually an issue using ObservableObject. Switching to a StateObject did the trick.

The view hit the onAppear but then was reloaded so the load never fired on the new ObservableObject. StateObject fixes this cause it isn't refreshed.

See https://sarunw.com/posts/how-to-initialize-stateobject-with-parameters-in-swiftui/ and https://stackoverflow.com/a/66463103/193772

@twodayslate twodayslate merged commit d5db27c into master Sep 14, 2021
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

Successfully merging this pull request may close these issues.

Allow swipe back for in-app safari
1 participant