Questions tagged [uiviewcontrollerrepresentable]

75 questions
1
vote
0 answers

SwiftUI: Setting AVPlayerViewController as a fullscreen background forces other views to ignore safe area

When I put AVPlayerViewController wrapped into UIViewControllerRepresentable as a fullscreen background of my view, it forces the main content view to ignore safe area. var body: some View { VStack(spacing: 0) { HStack { …
1
vote
1 answer

Can't drag down/dismiss UIColorPickerViewController

I am displaying a UIColorPickerViewController as a sheet using the sheet() method, everything works fine but I can't drag down/dismiss the view anymore. import Foundation import SwiftUI struct ColorPickerView: UIViewControllerRepresentable { …
1
vote
2 answers

Use VNDocumentCameraViewController as a UIViewControllerRepresentable in a TabView

I have VNDocumentCameraViewController as a UIViewControllerRepresentable in a view called ScanView embedded in a TabView as the 2nd screen. On dismissing the VNDocumentCameraViewController (either on cancelling or on saving of the scan), I want the…
1
vote
0 answers

SwiftUI make AVCaptureVideoPreviewLayer play nice with xStacks

I have a barcode scanner that is using Vision, and it works great. How do I get the camera to play nicely with my VStack? Currently when I add the cameraView, the cameraView doesn't play nicely with the VStack, meaning it gets added as…
Paul S.
  • 1,342
  • 4
  • 22
  • 43
1
vote
1 answer

UIViewControllerRepresentable height is too big

I am trying to add UIKit context menu to a SwiftUI view because SwiftUI context menu is pretty limited. I managed to do it, but UIViewControllerRepresentable takes more space than it needs. How can I resize it to fit the content inside it? Here is…
1
vote
1 answer

Is there a reason a UIViewControllerRepresentable should never be a class?

Let's say that you don't really need SwiftUI features. I.e. you don't have import SwiftUI in your file. Instead, you only require import protocol SwiftUI.UIViewControllerRepresentable In general, you're going to have to involve a delegate object:…
user652038
1
vote
0 answers

SwiftUI Send SMS with Coordinator and UIViewControllerRepresentable

How can I write the following code with UIViewControllerRepresentable? I want the code I write to be regular. Do you think it makes sense to write this code with UIViewControllerRepresentable? import MessageUI class ViewController:…
Ufuk Köşker
  • 1,288
  • 8
  • 29
0
votes
0 answers

How do I make UIViewControllerRepresentable fill up remaining space in an HStack?

I am looking to create a view in SwiftUI with a UITableView (inside a UIViewControllerRepresentable) taking up most of the screen, and a sidebar on the right. I would like to have the UIViewControllerRepresentable which contains the UITableView fill…
cwt1078
  • 25
  • 4
0
votes
0 answers

UIPageViewController doesn't prepare initially neighbouring view controllers in Swift

I'm developing an iOS app using SwiftUI with UIKit's UIPageViewController with UIViewControllerRepresentable and I'm not good with UIKit. I have array of three view controllers which are UIHostingControllers to which I pass my SwiftUI view which is…
0
votes
0 answers

Can't get Lumina camera to go away

I'm trying to develop an iOS app that has camera functionality using the Lumina framework. The majority of the app is built using SwiftUI, but I understand that Lumina was built to work with UIKit. I have set up a button that shows the camera, but I…
0
votes
0 answers

viewDidLayoutSubviews being called many times on orientation change in UIViewControllerRepresentable

I'm trying to implement a zoomable image in SwiftUI to display in a page view like the iOS photos app. I'm using UIViewControllerRepresentable to wrap a controller containing a UIScrollView to achieve this, and I'm running into a strange problem…
0
votes
0 answers

Original navBar isn't shown when a UIViewController is called from a swiftUI page

I am trying to call a view that has been designed by UIKit and this page has a custom navigation bar with bar buttons and a search text field on it ( designed by Storyboard), but when I try to call it from a swiftUI page the navigationBar is changed…
mohsen
  • 4,698
  • 1
  • 33
  • 54
0
votes
0 answers

Show UIKit PopUp in SwiftUI View

This question is quite similar to this question however, the solution there does not work for me. I have a predominantly UIKit app and now we are building some views using SwiftUI. To show alert pop ups, we are using this SwiftMessages library For…
0
votes
0 answers

UIViewControllerRepresentable content size changes when app returning from background

I have a SwiftUI simple application that presents UIViewControllerRepresentable that holds a UIScrollView. When app goes to background and returns back, the layout of the scroll view changes. struct FeedCategoryView: View { var viewModel:…
Sanich
  • 1,739
  • 6
  • 25
  • 43
0
votes
1 answer

Does not conform to protocol 'UIViewControllerRepresentable'

I'm completing the online apple Xcode Tutorial. At the UIKit tutorial portion, I'm repeatedly getting the same error: "Type 'PageViewController' does not conform to protocol 'UIViewControllerRepresentable'" That portion of the tutorial is a…