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

Fix visionOS SwiftUI bar interaction #167

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
approach to resolve an issue that could cause collection view cells to layout with
unexpected dimensions
- Made new layout-based SwiftUI cell rendering option the default.
- Fixed interaction of SwiftUI bars on visionOS

## [0.10.0](https://github.com/airbnb/epoxy-ios/compare/0.9.0...0.10.0) - 2023-06-29

Expand Down
5 changes: 4 additions & 1 deletion Sources/EpoxyBars/BarInstaller/BarStackView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,10 @@ public class BarStackView: UIStackView, EpoxyableView {
for (index, wrapper) in zOrderedWrappers.enumerated() {
// We pick 1000 as a sensible max to decrement from since we would never have that may bars.
// We don't decrement from 0 since that causes bars to be invisible for some reason.
wrapper.layer.zPosition = CGFloat(1000 - index)
// Due to a bug on visionOS, we need to clamp this to be between -1 and 1, otherwise
// interaction breaks for SwiftUI views.
// http://openradar.appspot.com/radar?id=5534724382523392
wrapper.layer.zPosition = CGFloat(1000 - index) / 1000
wrapper.zOrder = zOrder
}
}
Expand Down
Loading