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

Add SwiftUI proof of concept #481

Merged
merged 52 commits into from
Sep 25, 2021
Merged

Add SwiftUI proof of concept #481

merged 52 commits into from
Sep 25, 2021

Conversation

zntfdr
Copy link
Contributor

@zntfdr zntfdr commented Jul 5, 2021

Partially solves #281.

This PR adds a new example app which mimics the Maps.app, written in SwiftUI.

The code works for iOS 13+, however:

  • the project has been created with Xcode 13
  • the project uses the SwiftUI lifecycle (iOS 14+)

If it's ok, I will leave this PR as a draft until Xcode 13 is released.

In the meanwhile, I'm happy to receive any feedback you might have 😃

@zntfdr
Copy link
Contributor Author

zntfdr commented Jul 8, 2021

Thank you for the kind words!

View+floatingPanel.swift and FloatingPanelView.swift are not ready to be embedded into the main library yet, there are a couple of challenges that need to be addressed first:

  1. FloatingPanelControllerDelegate (currently hard-coded here https://github.com/scenee/FloatingPanel/pull/481/files#diff-2506b1aa7d7b41f96a92bc3b56ca1ebea04e5ddc6cd8401490016f1511e9b4e8R62)
  2. SurfaceAppearance (currently hard-coded here https://github.com/scenee/FloatingPanel/pull/481/files#diff-2506b1aa7d7b41f96a92bc3b56ca1ebea04e5ddc6cd8401490016f1511e9b4e8R72)

I will see what I can do to make the implementation more generic :)

@scenee
Copy link
Owner

scenee commented Jul 16, 2021

Thank you, @zntfdr. There is no problem to do that even after this PR. I'm looking forward to your improvements step by step. 😉

@zntfdr
Copy link
Contributor Author

zntfdr commented Jul 16, 2021

Thank you @scenee, I'm currently testing a generic implementation with my app (which uses 4 floating panels), and it seems to work great 😃

Once I complete the migration and documentation I will bring everything back in this PR 🙌🏻

@zntfdr
Copy link
Contributor Author

zntfdr commented Jul 25, 2021

Update: the implementation now is fully generic!

@scenee
Copy link
Owner

scenee commented Jul 31, 2021

I just took a look at the latest version. It looks so amazing!! I'm going to read your PR more closely later 😄

@scenee
Copy link
Owner

scenee commented Sep 18, 2021

I found an issue that the surface view's layoutSubviews() isn't called around tip state. It looks SwiftUI issue because it doesn't occurs when the absolute inset of tip state is greater than 90. I think this issue doesn't block your PR and it's better to release this as beta version and blush up the implementation step by step.

@zntfdr zntfdr marked this pull request as ready for review September 18, 2021 08:44
@zntfdr
Copy link
Contributor Author

zntfdr commented Sep 18, 2021

Thank you @scenee!
Now that we have Xcode 13 RC out, I think it's ok to merge 🙏🏻

@scenee
Copy link
Owner

scenee commented Sep 22, 2021

@zntfdr Can I move your SwiftUI API code into the library?

@scenee
Copy link
Owner

scenee commented Sep 25, 2021

@zntfdr told me an issue on SwiftUI's environment propagation into FloatingPanel.

SwiftUI's environment is propagated to all subviews. However Floatingpanel is not a subview, but a new view controller in the screen (and not a child view controller).

I believe people using floating panel would expect the environment to be propagated like other views, but this doesn't seem to be (always) the case.

It's possible to lead behaviors unexpected by SwiftUI users so that I will merge this PR as a sample code.

@scenee scenee merged commit 5f1d49b into scenee:master Sep 25, 2021
@skywalkerlw
Copy link

have we fully supported SwiftUI now, or it is still just POC?

@scenee
Copy link
Owner

scenee commented Nov 6, 2021

SwfitUI APIs are still PoC because we acknowledge there are some issues depending on SwiftUI.

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.

3 participants