Questions tagged [uiviewrepresentable]

229 questions
1
vote
1 answer

How to update the content inside the ScrollView : SwiftUI

I am trying to update my content inside the scroll view but since makeUIView called only once when view builds. It doesn't refresh when I click on 1 image and then 2 images. However, If I click on No image and then click on Image 2 it works as…
Malav Soni
  • 2,739
  • 1
  • 23
  • 52
1
vote
1 answer

Issue when binding text between UITextField with UIViewRepresentable and SwifUI

I'm trying to make an 'emoji picker' in SwiftUI which brings ups the emoji keyboard, allows the user to select an emoji, and then dismisses the keyboard. I'm using a UITextField wrapped in a UIViewRepresntable with a String Binding, however the…
Richard Robinson
  • 867
  • 1
  • 11
  • 38
1
vote
2 answers

Some cells of UITableView with UIViewRepresantable are positioned wrong

I am trying to use UITableView with UIViewRepresantable, it kinda works, but not really. Some rows are placed in the wrong place, either overlapping other rows, either extra padding is added. Also it doesn't seem to adapt the row height to the…
Claudiu
  • 485
  • 1
  • 4
  • 17
1
vote
0 answers

SwiftUI - Listening for authorization status on location permission

I am using SwiftUI to present a map using UIViewRepresentable, and getting the coordinates with CLLocationManager. So, in updateUIView, I am requesting authorization and checking authorization status in order to present the user's location, but…
1
vote
1 answer

Start / update View in userContentController - Function

I try to start a second view with the help of the WKWebview by clicking a button. It also works. I get a callback in the function userContentController. How is it possible to start a new view in the app from this function. struct MyWebView:…
PureFlow
  • 33
  • 1
  • 6
1
vote
2 answers

UIViewRepresentable hidden behind SwiftUI View

I recently asked (and got a valid answer) to a question related to this issue. How do I get my UIViewRepresentable to correctly size for its content? As I mentioned in the previous post, I want to use the awesome MultiSegmentPicker written by…
Mozahler
  • 4,958
  • 6
  • 36
  • 56
1
vote
0 answers

How to Update binding value to my video player using updateUIView

I just have a simple videplayer I want to update the current video but I don´t know how struct VideoPlayerView: UIViewRepresentable { @Binding var videoURL: URL? func makeUIView(context: Context) -> UIView { return…
Misael Landeros
  • 545
  • 5
  • 18
1
vote
1 answer

UIViewRepresentable wont update my ios chart dataset

I am trying to my data derived from an API into a line chart but I can't seem to get it to work. I am storing the data in an observable object so it takes a few seconds to get it so it won't show up on my graph but when I hardcode data it works I am…
Anthony
  • 31
  • 1
  • 9
1
vote
0 answers

UITextView wrapped in UIViewRepresentable doesn't show copy/paste menu

This is a custom textview with overrided method override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { return (action == #selector(UIResponderStandardEditActions.copy(_:))) }
saniaxxx26
  • 442
  • 1
  • 3
  • 10
1
vote
0 answers

SwiftUI UIViewRepresentable MKMapView With Selectable MKCircles loses selection when adding new Circle

I've been wrestling with getting SwiftUI working with MKMapView for a few days now. With the help of posts on here Accessing MKMapView elements as UIViewRepresentable in the main (ContentView) SwiftUI view and articles like this online…
jimbobuk
  • 1,211
  • 12
  • 25
1
vote
3 answers

How to reload collectionview in UIViewRepresentable SwiftUI

## How to reload collection view in UIViewRepresentable ## Working with UIViewRepresentable and collection view, got stuck when its comes to reload() collection view after iterating, how to reload collection view in UIViewRepresentable when…
1
vote
0 answers

SwiftUI - Embedded UITextField invokes the shouldChangeCharacters delegate method for suggested text

I'm using UIViewRepresentable to wrap a UITextField in order to create a TextField view for SwiftUI which is more fully featured than the currently built-in one. The Coordinator class is of course the delegate of the UITextField. The delegate method…
1
vote
0 answers

Using Material MDCCard in SwiftUI with UIViewRepresentable size issue

I'm trying to use Material components MDCCard in SwiftUI and trying to make its size exactly as its subviews but I end up with stretched size to fill any available space in its parent. How could I make its size wraps its content. Here is my…
1
vote
2 answers

PencilKit in SwiftUI

I'm trying to use PencilKit in SwiftUI. How can I detect in the updateUIView-function, which Binding-variable was updated? For example I don't want to clear the canvas when changing the color. And is there a better way to clear the canvas than…
simibac
  • 7,672
  • 3
  • 36
  • 48
1
vote
2 answers

How to create a wrapper for PKPaymentButton

I'm trying to implement the PKPaymentButton in SwiftUI, but I cannot figure out how to create a wrapper for the PKPaymentButton. My code is below: struct ApplePayButton: UIViewRepresentable { func makeUIViewController(context: Context) ->…
micma
  • 223
  • 2
  • 4
  • 16