-
Notifications
You must be signed in to change notification settings - Fork 76
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 macOS and tvOS support to EpoxyCore #143
Conversation
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.
This is really awesome @calda I made some comments and am curious what your thoughts are. We will want want this to be a major version bump if we do end up making breaking naming changes
Sources/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringUIViewRepresentable.swift
Outdated
Show resolved
Hide resolved
Sources/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringUIViewRepresentable.swift
Outdated
Show resolved
Hide resolved
Overall approach LGTM |
This PR is ready for review now @airbnb/epoxy-ios-maintainers |
### Fixed | ||
- ... | ||
|
||
## [0.10.0](https://github.com/airbnb/epoxy-ios/compare/0.9.0...0.10.0) - 2023-06-29 |
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.
Should we release these changes as 0.10.0 after merging this PR or should I leave it under "Unreleased"? (Somebody else would have to cut the release since I don't have write access)
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.
@calda I'm wondering if we should cut a release before these changes, and then do a new release after these changes have been merged so we can include the other non-breaking changes currently unreleased?
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.
Good idea, that makes sense. We could release 0.9.1
and then 0.10.0
?
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.
Well, looking at the CHANGELOG we've only every cut releases like 0.6.0
, 0.7.0
, 0.8.0
, 0.9.0
. So I guess this should be 0.10.0
without the breaking changes (not 0.9.1
) and then 0.11.0
with the breaking changes?
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.
Here you go: #144
Opening this PR as a discussion starter. Consider this a proof-of-concept.
Starting in airbnb/lottie-ios#2092 we're using EpoxyCore's SwiftUI
UIViewConfiguringSwiftUIView
to provide a SwiftUI wrapper for Lottie'sLottieAnimationView
UIView.EpoxyCore currently only officially supports iOS, but Lottie also supports tvOS and macOS.
If EpoxyCore supported macOS, we could provide Lottie SwiftUI support on all Apple platforms. This lets you, for example, create a single SwiftUI app which uses Lottie and can be ran on all Apple platforms.
There are two types of changes that have to be made to support macOS / AppKit:
UIView
withNSView
(etc). This PR implements that with atypealias UIViewOrNSView
which resolves to eitherUIView
orNSView
depending on the platform. Most of EpoxyCore compiles successfully with just these changes.#if os(macOS)
as necessary whereUIView
andNSView
have different APIs or behaviors. The most important example of this is inSwiftUIMeasurementContainer
, where the behavior has to be slightly different on macOS.To me these changes feel relatively noninvasive. It's especially reassuring that there are only a few places where we have to implement different runtime behavior depending on the platform.
What do folks think?
If we're ok with this direction I'll work on further productionizing these changes, e.g. by adding more code comments and by adding CI jobs that test the tvOS and macOS support.
Example screenshots from a multiplatform SwiftUI app using Lottie, running on macOS and tvOS with a single codebase using the changes in this PR:
macOS / AppKit
tvOS / UIKit
Source code of example: