Questions tagged [uiviewcontrollerrepresentable]
75 questions
0
votes
0 answers
SwiftUI UIViewRepresentable with argument passed and delegate function
I am implementing a UIViewController with a ViewModel as an argument passed to the UIViewController, but I can't seem to make the delegate functions to work, what is the correct way of doing this?
CartView.swift
struct PaymentWrapper:…

Charas
- 1,753
- 4
- 21
- 53
0
votes
1 answer
SwiftUI wrapping UIViewController using UIViewControllerRepresentable
I have question about wrapping custom UIViewControllers into SwiftUI view using UIViewControllerRepresentable. Does anyone have issue with UITextFields in such case?
I have situation that sometimes this textfield works normally when wrapped and…

Michał Ziobro
- 10,759
- 11
- 88
- 143
0
votes
1 answer
How can i show UIViewControllerRepresentable screen on button tap from UIViewRepresentable
I am working on a SwiftUI project, in my app i have to show a map, i am able to show map using UIViewRepresentable, now that map view will have a button and on tapping on that button mapview will needs to show controller (full screen direction) view…

Programming Learner
- 4,351
- 3
- 22
- 34
0
votes
1 answer
Defer system edge gestures in only some view controllers. SwiftUI
I want to navigate to a custom UIView where the system edge gestures are disabled. I am using the SwiftUI life cycle with UIViewControllerRepresentable and overriding preferredScreenEdgesDeferringSystemGestures.
I have seen the solutions with…

Patrik T
- 47
- 1
- 7
0
votes
0 answers
send an event from UIViewControllerRepresentable to swiftui view
I try to catch an event that occurs in a UIViewController in the SwiftUI view.
the architecture is in SwiftUI with an element in Swift:
The View
struct PlayGame: View {
var body: some View {
if stateProgress.stateOfGame == 0 {
…

Rufilix
- 253
- 3
- 22
0
votes
0 answers
Why does Injecting a Binding into UIViewControllerRepresentable cause a retain cycle?
So there seems to be a retain cycle when injecting a Binding that is a published property from an ObservableObject into UIViewControllerRepresentable.
It seems if you create a view inside another view in and that second view has an ObservableObject…

wshamp
- 131
- 4
0
votes
1 answer
SwiftUI - Show custom ViewController from View
I have a Button in my View that call a custom View Controller (UIViewControllerRepresentable) because, the external library that I use, needs a view controller as parameter to show its own popups (and of course I cannot change).
For this reason I've…

elp
- 8,021
- 7
- 61
- 120
0
votes
1 answer
SwiftUI + UIPageViewController, multiple view types
I want to use a UIPageViewController in my SwiftUI app, as demonstrated in this tutorial. However, the tutorial passes in identical view types as pages, and I want to pass in any type of view.
struct PageViewController:…

bze12
- 727
- 8
- 20
0
votes
1 answer
Back button in UIViewControllerRepresentable goes to root view instead of going back to previous view
I have a SwiftUI app that has three levels:
Main List (SwiftUI NavigationView)
Secondary List (SwiftUI NavigationView)
An UIViewControllerRepresentable
In my secondary list I have
NavigationLink(destination: ARView(museum: self.museum)) {
…

kristiankeller
- 1
- 1
0
votes
1 answer
Creating PDF in Swift, UIView to View using UIViewRepresentable
I'm trying to create a simple PDF with Swift. I get an error:
Referencing static method 'buildBlock' on 'Optional' requires that 'UIView' conform to 'View'
Probably doing a ton of stuff wrong. I think I need to be able to somehow change the UIView…

Etienne
- 89
- 4
0
votes
1 answer
SwiftUI - Unbalanced Calls To Begin/End Appearance Transitions For
I have a .onTapGesture modifier that when tapped presents an ImagePicker before immediately dismissing it.
@State private var updateInfo = false
var body: some View {
HStack {
placeholder.image
.resizable()
…

David
- 333
- 1
- 2
- 14
0
votes
0 answers
Can UIActivityViewController work properly with SwiftUI - seems really buggy
I am really struggling to get a UIActivityViewController to work as as a UIViewControllerRepresentable in SwiftUI. When trying to share to WhatsApp, for example, the screen just moves slightly as if some action is going to happen, then it returns to…

codewithfeeling
- 6,236
- 6
- 41
- 53
0
votes
1 answer
Custom UIViewController with UIViewcontrollerRepresentable that has a UITextView that crashes or is nil when called in SwiftUI
I have made a custom UIViewController called ViewControllerA and want to be able to use it so I made a UIViewControllerRepresentable called ViewControllerARepresentable as shown below, the problem though is that when I call…

Di Nerd Apps
- 770
- 8
- 15
-1
votes
1 answer
How do you show a UIViewControllerRepresentable in SwiftUI as a non-sheet?
There are many tutorials out there on how to show a UIViewControllerRepresentable (e.g. to show a VNDocumentCameraViewController) as a sheet, but is there any way to show it as a regular view using NavigationLink, or just including it in another…

Stone
- 309
- 2
- 3
- 12