Questions tagged [uiviewrepresentable]
229 questions
0
votes
1 answer
Cycle detected through use of UIKit Textfield Representable in SwiftUI
I am using a boolean (searchVM.showSearchView: Bool) to simultaneously turn opacity of a SearchView to 1.0 AND show/hide a UIRepresentableKeyboard.
This gives me the same functionality as Google Maps when you tap on the search bar and…

Jake Smith
- 580
- 3
- 11
0
votes
2 answers
Center MPVolumeView vertically in SwiftUI view
I want to place an MPVolumeView in my SwiftUI view but it doesn't behave like a normal SwiftUI view. I want the volume slider to be centered vertically between the two dividers. If you replaced VolumeSlider with Text it would be centered. How can I…

Steve M
- 9,296
- 11
- 49
- 98
0
votes
0 answers
SiwftUI: update model in UIViewRepresentable Coordinator when View updates?
So I am using a WKWebView within UIViewRepresentable so I can show a web view in my SwiftUI view.
For a while I could not figure out why my SwiftUI view would not update when the Coordinator would set @Publsihed properties that affect the SwiftUI…

zumzum
- 17,984
- 26
- 111
- 172
0
votes
1 answer
ZoomableScrollView no longer works in SwiftUI
Using Swift 5.5, Xcode 13.0, iOS 15.0.1,
Since Apple does not a good job on ScrollViews for SwiftUI (yet?), I had to implement my own zoomable ScrollView. See code below.
I had it successfully running for iOS13 and iOS14 - but now updating to iOS…

iKK
- 6,394
- 10
- 58
- 131
0
votes
1 answer
Set exclusive touch between UIRepresentableView and SwiftUI's View
I had a UIViewRepresentable implementation for a UITextView, to be able to display and handle links on UITextView {
let textView =…

José Roberto Abreu
- 176
- 1
- 14
0
votes
1 answer
Unexpected acting of MapKit in SwiftUI
I'm stuck with the really strange problem. I'm implementing map into my SwiftUI app. It should act like a normal map (drag, scroll and so on). When changing position (that is binding point) the app gets an address via geocoder.
Also user can click…

Alex Holxey
- 73
- 10
0
votes
1 answer
How to use PKAddPassesViewController inside SwiftUI using UIViewControllerRepresentable?
I am attempting to get PKAddPasses to work on SwiftUI. With my code provided, I am able to get the add pass screen to show up. When pressing "Add", the pass gets added to the Wallet. However, neither the "Add" nor the "Cancel" button make the view…

Ashley Bailey
- 1
- 1
0
votes
1 answer
How do I change the height of this UIViewRepresentable?
I found this code on the web :
struct CustomTextField: UIViewRepresentable {
@Binding var text: String
@State var placeholder: String
func makeCoordinator() -> Coordinator {
Coordinator(text: $text)
}
func…

Kunal Katiyar
- 304
- 2
- 15
0
votes
1 answer
Swiftui photoOutput for Images not called every time
This is actually the same issue as this post AVCapturePhotoCaptureDelegate photoOutput() not called every time however no one responded to that . I find that on takePic the photoOutput function is called sometimes and not others it is literally…

user1591668
- 2,591
- 5
- 41
- 84
0
votes
0 answers
How to change View while app is running in SwiftUI
struct AnimationView: UIViewRepresentable {
@Binding var cnt: Int
var imageView: UIImageView = UIImageView(image: effctPicker(cnt: 0))
func makeUIView(context: Self.Context) -> UIImageView {
return imageView
}
func…

jin96
- 1
- 1
0
votes
1 answer
SwiftUI AVPlayer - How to pause and resume playing?
So I made a view called "VideoElement" that will play a video in the background when the parent view loads. It worked well. However, I cannot figure out how to implement a pause/resume system. I want to change a variable (var "paused") which would…
user16109489
0
votes
1 answer
Coordinator is not working for UIViewRepresentable?
Maybe I don't understand UIViewRepresentable correctly but I thought this would work.
I'm trying to use two classes that are UIViewRepresentable to display my scnkit scenes in SwiftUI. I also use two coordinator methods for the classes, one each.…

James Castrejon
- 567
- 6
- 16
0
votes
1 answer
MapView: UIViewRepresentable do NOT center to fetched listings
I try to create a map populated with fetched listings from core data. Fetching is perfect, but the map is not centering to listings location.
For example all listings are located un USA but my map is showing Romania (my location).
How can i tell the…

Marius Geageac
- 47
- 5
0
votes
1 answer
Modal with WKWebView closes on text field focus
I have a simple sheet that contains UIViewRepresentable. It opens a web page and not much more than that. I have this module in two parts of my app. One works great, but another when I focus on a text field, immediately closes the modal and gives me…

Alex Holxey
- 73
- 10
0
votes
1 answer
iOS SwiftUI: How to detect location of UITapGesture on view?
Using Mapbox, the map struct conforms to the UIViewRepresentable protocol. In my makeUIView() function, I create a tap gesture recognizer and add it to the map view.
struct Map: UIViewRepresentable {
private let mapView: MGLMapView =…

nickcoding
- 305
- 8
- 35