# UIPortalBridge
**Repository Path**: guyijie/UIPortalBridge
## Basic Information
- **Project Name**: UIPortalBridge
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2026-02-22
- **Last Updated**: 2026-02-22
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
UIPortalBridge
A lightweight wrapper around Apple's private _UIPortalView for UIKit and SwiftUI.
Portal views display a live mirror of another view. The mirrored content updates in real-time.
Looking for SwiftUI transitions? See [Portal](https://github.com/Aeastr/Portal) (experimental, pure SwiftUI) or [Transmission](https://github.com/nathantannar4/Transmission) (mature, UIKit-backed).
> **WARNING: Private API Usage**
>
> This package uses Apple's private `_UIPortalView` API. 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 importing `UIPortalBridge`, you accept full responsibility for any consequences.
## Installation
```swift
dependencies: [
.package(url: "https://github.com/Aeastr/UIPortalBridge", from: "1.0.0")
]
```
```swift
import UIPortalBridge
```
## UIKit
```swift
let 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 position
```
Check `portal.isAvailable` to verify the private API is available on the current iOS version.
## SwiftUI
### Basic Usage
```swift
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 Options
```swift
PortalView(
source: container,
hidesSource: false,
matchesAlpha: true,
matchesTransform: true,
matchesPosition: true
)
```
### Using with Raw UIView
If you have a `UIView` reference:
```swift
PortalViewRepresentable(
sourceView: myUIView,
hidesSourceView: false,
matchesAlpha: true,
matchesTransform: true,
matchesPosition: true
)
```
## API
### UIPortalView
| 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 |
### SourceViewContainer
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 |
## License
MIT