Questions tagged [uiviewcontrollerrepresentable]
75 questions
2
votes
1 answer
Multiple NavigationLinks leading to UIViewControllerRepresentable destination ends up with blank screen
I have found a minimal SwiftUI app that exhibits a bug:
class HelloWorldVC: UIViewController {
override func loadView() {
super.loadView()
let label = UILabel()
label.text = "Hello, World"
view.addSubview(label)
…

Jeremy
- 2,801
- 2
- 30
- 31
2
votes
3 answers
SwiftUI • How to implement half-Screen ShareSheet?
I implemented a ShareSheet into my SwiftUI App using UIViewControllerRepresentable.
Code
struct ShareView: UIViewControllerRepresentable {
typealias Callback = (_ activityType: UIActivity.ActivityType?, _ completed: Bool, _ returnedItems:…

christophriepe
- 1,157
- 12
- 47
2
votes
1 answer
Navigating to a SwiftUI view from a button pressed in a UIViewControllerRepresentable
I am using a Swiftui list to show tasks. Each task has a location. When you click on the list row I am using a NavigationLink to navigate to a details page.
I am using a UIViewControllerRepresentable that creates a map view with all the task…

Cameron McBroom
- 485
- 5
- 8
2
votes
1 answer
Safe area issue with VNDocumentCameraViewController using UIViewControllerRepresentable
How can I extend camera scanning view to safa area while using VNDocumentCameraViewController in UIViewControllerRepresentable?
here is the code
struct ScanDocumentView: UIViewControllerRepresentable {
func makeCoordinator() -> Coordinator…

Carter Stevenson
- 71
- 4
2
votes
1 answer
SwiftUI Coordinator: method can not be marked @objc
Using a UIViewController in SwiftUI I need to assign selectors for two buttons. Those need to be @objc but I get the error:
Method cannot be marked @objc because the type of the parameter cannot be represented in Objective-C
struct ScanPreView:…

Mike Koene
- 330
- 3
- 15
2
votes
1 answer
SwiftUI with UIViewControllerRepresentable
I am trying to use a UIViewController representable in a swiftUi project. Specifically I am trying to press one button (assetOne) that allows the EU to select a video and then press another button (assetTwo) and it allows the user to select another…

Part_Time_Nerd
- 994
- 7
- 26
- 56
2
votes
1 answer
How to pop a UIViewControllerRepresentable from a SwiftUI navigation stack programmatically
Here is my SwiftUI setup:
I have a SwiftUI view (called MapSearchView) that has a NavigationView that contains a NavigationLink.
var body: some View {
VStack {
NavigationView {
Form {
Section (header:…

Ferdinand Rios
- 972
- 6
- 18
2
votes
1 answer
Background color on Navigation Bar is not set when my SwiftUI based app is launched in landscape mode
I am working with a SwiftUI based app that relies on a NavigationView to transition from screens.
I have a requirement to set the background color on the navigation bar and have found code that makes this work most of the time.
When the app is…

CodeBender
- 35,668
- 12
- 125
- 132
1
vote
0 answers
PHPickerViewController Selected Photos Preview not showing close button
I am having this weird and odd behaviour with the PHPickerViewController. I am using SwiftUI and I have implemented the PHPickerViewController as a UIViewControllerRepresentable and everything seems to be working 100% fine expect when the user taps…

BrettS
- 295
- 6
- 14
1
vote
1 answer
How to replace back button of NavigationView from inside a UIViewControllerRepresentable?
Consider a UIVIewController where a custom back button needs to be set. The reason is that the user should be presented a confirmation dialog before navigating back where they can cancel the navigation, in case the back button was tapped…

Manuel
- 14,274
- 6
- 57
- 130
1
vote
1 answer
Updating published variables using DispatchQueue.main.async in SwiftUI
I am working on a SwiftUI app that displays an AVCaptureVideoPreviewLayer and also implements the AVCaptureVideoDataOutputSampleBufferDelegate protocol to perform some custom logic in captureOutput(_: didOutput: from:). The custom logic was working…

John Harrington
- 1,314
- 12
- 36
1
vote
1 answer
Rotation of UIViewRepresentable View using AVFoundation
I am using CameraPreview (UIViewRepresentable) as a bridge between UIKit and SwiftUI. CameraPreview is configured with CameraModel and uses AVCaptureVideoPreviewLayer. CameraModel is configuring AVCaptureSession, and AVCaptureDeviceInput.…

Mr.SwiftOak
- 1,469
- 3
- 8
- 19
1
vote
1 answer
bg color of view controller status bar area in UIViewControllerRepresentable
I am using a UIViewControllerRepresentable for a view controller that can accomplish things I can't do in SwiftUI. I am trying to get the status bar area appear the same color as the dark blue, but it persists in being white. I tried earlier to…

Casey Perkins
- 1,853
- 2
- 23
- 41
1
vote
0 answers
Lock device orientation for SwiftUI UIViewControllerRepresentable
I have a UIViewController that I need to wrap and use as a SwiftUI view. I have implemented the methods needed to lock device orientation for that view controller. When I use the UIViewController in an UIKit context, the orientation could be…

S Sathish Kumar
- 11
- 1
1
vote
1 answer
Conditionally assigning a view of type UIViewControllerRepresentable fails to render changes when State is changed
Pressing the "FIRST" or "SECOND" Text views should change the State selection and update selectedView accordingly. While the debugger shows that pressing "FIRST" or "SECOND" causes body to be re-evaluated and correctly assigns selectedView, the…

Ryan Pierce
- 1,583
- 16
- 24