-
Notifications
You must be signed in to change notification settings - Fork 443
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
SwiftUI sample #398
base: master
Are you sure you want to change the base?
SwiftUI sample #398
Conversation
Great work! I look forward to seeing this fleshed out more perhaps with more SwiftUI proper examples perhaps, maybe even a catalog for SwiftUI examples. |
Thank you for this contribution @kutakmir! There are some great examples in here for CareKit SwiftUI adapters. It seems like this work will be well suited as an example for others who want to use SwiftUI with CareKit. It's probably best that we don't merge this into
Let us know which route will be most helpful for you and the community! |
@gavirawson-apple wouldn't it be better in the @ericlewis I saw your comments in: #394. What is the status of your wrappers? Shall we sync up to collaborate on this feature? |
@kutakmir would love to sync up, I have been working on something more along these lines: https://github.com/ericlewis/CKUI/blob/master/CKUI/ContentView.swift I am considering that implementing the UI as pure SwiftUI would be the easier move, and wanted to create more idiomatic SwiftUI-ish wrappers around the controllers for easy of use. Eventually there will be a |
I see. Writing pure SwiftUI has many benefits. @gavirawson-apple what is the Apple's strategy regarding SwiftUI? |
SwiftUI is definitely a powerful tool, and something we are thinking of supporting in the future. However, at the moment all of our views are written using UIKit. Using tools like @ericlewis's approach of rebuilding the views in SwiftUI will be a good route going forward. While the views will need to be recreated from scratch, our controllers are equipped and ready for SwiftUI. The general approach is outlined here. If you're up for the work, you might want to consider creating a SwiftUI catalog running parallel to our UIKit catalog. |
@gavirawson-apple If tools like UIViewRepresentable and UIViewControllerRepresentable are definitely the correct approach for adapting CK views to SwiftUI, would you guys consider the effort to create a SwiftUI-based sample app useful and worthwhile at this stage? |
To clarify, I think it will be useful to have a section in the catalog app that showcases pure SwiftUI views built from scratch. Building out the views in SwiftUI will help solve any layout issues you have encountered. Showcasing the UIKit views using SwiftUI adapters is probably less useful, given that the process is generally the same for all of the views (using |
902b8ff
to
453eb20
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this hard work! As I mentioned before, it will be most useful to provide examples of CareKit views rewritten in SwiftUI. Those can be best showcased inside of a new tab in OCKCatalog (not within a copy of the target).
See this PR for a new SwiftUI API around the InstructionsTaskView
. Also check out our updated README with info on SwiftUI in CareKit and SwiftUI in CareKitUI. The API is a starting point to demonstrate the SwiftUI API architecture. We would love to integrate community contributions that follow the API structure!
Hi, |
This is the first step towards resolving some of the SwiftUI-related issues that many of us have and to showcase the compatibility of CareKit with SwiftUI.
Here I only rewrote the existing sample.