265 questions
0
votes
1
answer
91
views
SwiftUI UITextView jumps to the top when typing and text wraps to a new line
I have a custom UITextView wrapped in SwiftUI using UIViewRepresentable.
The goal is to have a dynamic height text view that grows as the user types.
Here is a simplified version of my code:
...
1
vote
1
answer
42
views
UIViewRepresentable with fixedSize in HStack
I have a UIViewRepresentable wrapping an UIView that contains a UILabel.
I'm trying to position this representable view inside a HStack and I'd like it to take the width of the underlying label.
Here ...
2
votes
0
answers
52
views
UIScrollView zoomed UIImageView doesn’t bounce on vertical edges during pan
The Issue
I've created a zoomable image component for SwiftUI by wrapping UIScrollView and UIImageView using UIViewRepresentable. The core functionality, like pinch-to-zoom, double-tap-to-zoom, and ...
1
vote
1
answer
216
views
Can UIViewRepresentable host a SwiftUI view or should UIViewControllerRepresentable be used [duplicate]
I found different examples for UIViewRepresentables which host a SwiftUI View, e.g. here. (see code below)
The approach is always to create a UIHostingController with the UIViewRepresentable and add ...
1
vote
1
answer
43
views
WKWebview/UIViewRepresentable - Hide Loading... text while webview is loading
I have the following UIViewRepresentable to load a webview.
struct SViewerWebView: UIViewRepresentable{
var url: String
var token: String
@Binding var isLoading: Bool
func ...
0
votes
1
answer
86
views
How to write a view that provides a proxy to interact with a AppKit/UIKit view, akin to ScrollViewReader?
I am trying to write a NSViewRepresentable wrapper for NSOutlineView that allows users to programmatically expand/collapse items from the SwiftUI side. I am doing this because the SwiftUI List(_:...
0
votes
1
answer
354
views
Force refresh of UIViewRepresentable on orientation change
I have a custom UITextView as an UIViewRepresentable in my SwiftUI app. Using TextKit2, I determine regions where I do drawing.
Everything works fine, except when I rotate the device (Simulator or ...
0
votes
0
answers
126
views
Difference in the Coordinator for UIViewRepresentable and UIViewControllerRepresentable
Why does the Coordinator for UIViewRepresentable written so verbose? Given below are two fragments of code, one using UIViewRepresentable and one using UIViewControllerRepresentable:
struct ...
1
vote
1
answer
561
views
SwiftUI's layout engine does not respect content size of UIViewRepresentable and expands size to whole screen
I'm trying to incorporate a UIViewRepresentable into my SwiftUI app. My goal is that the view is displayed with the dimensions (especially height) it needs to fit the content. However, SwiftUI somehow ...
2
votes
0
answers
78
views
FSCalendar Coordinator class in SwiftUI doesn't update States
Explanation for reproducing:
I'm using FSCalendar to display a calendar in my SwiftUI app. When a date is tapped I display a sheet on my CalendarView.swift. I have events for some dates and when those ...
0
votes
1
answer
133
views
SwiftUI: Issues Combining TabView and UIViewRepresentable
I am encountering an issue when combining SwiftUI TabView with UIViewRepresentable.
I have customized a video/stream player using MobileVLCKit and UIViewRepresentable.
I have a view that displays ...
1
vote
1
answer
99
views
How to set isUserInteractionEnabled to false on specific UIViewRepresentable TextField accompanied with regular SwiftUI Text Fields
I have SwiftUI View where are two normal TextFields and one UIViewRepresentable UITextField.
I need to turn off possibility of copy/paste/select on UIViewRepresentable while typing values.
I'm doing ...
2
votes
0
answers
94
views
UICalendarView NSInvalidArgumentException Error
I am encountering an error when attempting to cache decorations in a UICalendarView. The code to reproduce the error is as follows:
class Coordinator: NSObject, UICalendarViewDelegate, ...
0
votes
1
answer
358
views
SwiftUI WkwebView UIViewRepresentable is called twice or more and get error NSURLErrorDomain error -999
this page is loading twice. I Tried to intercept the error, using some "isLoading" @State var, but is not working. I think in my setup there is some other error, maybe in the way I ...
1
vote
0
answers
214
views
I'm looking to integrate CalendarKit library with SwiftUI Representable, facing issue with data handling
I'm attempting to implement CalendarKit using SwiftUI's UIViewControllerRepresentable. The example provided by the library is in UIKit. I've successfully displayed the UI, but when I try to pass dummy ...
0
votes
2
answers
301
views
How to make update View when use UIViewRepresentable in swift project
I am working on showing the React-native-View in the swift project. I download the bunlde file through asynchronous operation, save the bundle file in the app directory, and use it to create the ...
0
votes
0
answers
173
views
Spotlighting / Highlighting a specific part of a UIView that is wrapped with a UIViewRepresentable?
For extra context, this is a follow up question to this. Would appreciate reading that post as theres quite a bunch of context as to my initial approach and what I need to ultimately accomplish.
I ...
1
vote
0
answers
86
views
Getting error even after conforming to UIViewControllerRepresentable protocol
Whenever I try to use the below code snippet in our existing UIKit project, I get the following error. When I move the same code to another Xcode project, it works perfectly.
On clicking Xcode ...
3
votes
1
answer
994
views
How to observe multiple changes in UIViewRepresentable?
Continuing from my previous question, what is the best way to observe several state changes from a UIViewRepresentable? Previously, I required to only observe changes to one property userWon. However, ...
0
votes
2
answers
511
views
Getting UIViewRepresentable to run a block just once
I'd like to wrap a CaptureSession in a SwiftUI view. The current way I'm doing this is:
struct VideoPreviewView: UIViewRepresentable {
@EnvironmentObject var cameraManager: CameraManager
func ...
1
vote
0
answers
484
views
How can I reinitialize a UIViewRepresentable when a value changes?
So let's say we have the following code:
struct MyView: UIViewRepresentable {
@Binding var myValue: Int
func makeUIView(context: Context) -> MyOtherView {
let someValue = ...
0
votes
1
answer
769
views
How to make a custom UIViewRepresentable fill its parent VStack and have custom subview centered in it?
So I have the following in my project.
ContentView ~ contains 3 vstacks.
CustomView ~ a custom view with a containerView with fixed size of 300x300 that should always be centered in ContentView
...
1
vote
0
answers
161
views
I am Using LazyHGrid / LazyHStack inside Custom ScrollView(UIScrollView), but lazy nature is not working
Can anybody tell me how can i set offset in a ScrollView?I have checked ScrollTo(), which scroll to index wise. But I want to move scrollview with offset. I have also checked Custom ScrollView( from ...
0
votes
0
answers
140
views
Type '...View' does not conform to protocol 'UIViewRepresentable'
So I want to view pdf from core data but stuck on this issue
struct PDFView: View {
var pdfData: Data?
var body: some View {
if let pdfData = pdfData, let document = PDFDocument(data: ...
0
votes
1
answer
726
views
SWIFTUI ViewModifier using UIViewRepresentable; getting a value from the UIView to my SwiftUI View
I have a custom modifier on a SwiftUI View to pan and zoom an Image. I need to get the location where the user long presses. The modifier uses an UIView (UIViewRepresentable) under the hood where the ...