Portal views display a live mirror of another view. The mirrored content updates in real-time.
Looking for SwiftUI transitions? See Portal (experimental, pure SwiftUI) or Transmission (mature, UIKit-backed).
WARNING: Private API Usage
This package uses Apple's private
_UIPortalViewAPI. Apps using private APIs may be rejected by App Store Review. Use at your own discretion. UIPortalBridge, Aether, and any maintainers assume no responsibility for App Store rejections, app crashes, or any other issues arising from the use of this package. By importingUIPortalBridge, you accept full responsibility for any consequences.
dependencies: [
.package(url: "https://github.com/Aeastr/UIPortalBridge", from: "1.0.0")
]import UIPortalBridgelet sourceView = UILabel()
sourceView.text = "Hello"
let portal = UIPortalView()
portal.sourceView = sourceView
// Optional configuration
portal.hidesSourceView = false // Hide the source while portaling
portal.matchesAlpha = true // Match source alpha
portal.matchesTransform = true // Match source transform
portal.matchesPosition = true // Match source positionCheck portal.isAvailable to verify the private API is available on the current iOS version.
struct ContentView: View {
@State private var container = SourceViewContainer {
Text("Original Content")
.padding()
.background(.blue)
}
var body: some View {
VStack {
// Source view
SourceViewRepresentable(
container: container,
content: Text("Original Content")
.padding()
.background(.blue)
)
// Portal (live mirror)
PortalView(source: container)
}
}
}PortalView(
source: container,
hidesSource: false,
matchesAlpha: true,
matchesTransform: true,
matchesPosition: true
)If you have a UIView reference:
PortalViewRepresentable(
sourceView: myUIView,
hidesSourceView: false,
matchesAlpha: true,
matchesTransform: true,
matchesPosition: true
)| Property | Type | Default | Description |
|---|---|---|---|
sourceView |
UIView? |
nil |
The view to mirror |
isAvailable |
Bool |
- | Whether the private API is available (read-only) |
hidesSourceView |
Bool |
false |
Hide source while portaling |
matchesAlpha |
Bool |
true |
Match source alpha |
matchesTransform |
Bool |
true |
Match source transform |
matchesPosition |
Bool |
true |
Match source position |
Holds a SwiftUI view and exposes its underlying UIView for portaling.
| Property | Type | Description |
|---|---|---|
view |
UIView |
The underlying UIView |
| Method | Description |
|---|---|
update(content:) |
Update the container's content |
MIT