Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
27 views

UIViewRepresentable TextField that can append a uneditable string and follows other rules

In Swift UI I am struggling to find a solution to editing Int16 and Double values primarily linked to CoreData entities. The SwiftUI TextField("key", value: $int16, format: .number) crashes ...
miothethis's user avatar
1 vote
0 answers
34 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 ...
Alp Durak's user avatar
0 votes
0 answers
18 views

Video Preview not showing until the app is pushed into the background

I have an app written in SwiftUI that shows a video preview. When I go to the view that should show the preview it is not there. If I start to pull the screen up to put the app in the background the ...
James Stacy's user avatar
0 votes
1 answer
30 views

UITextView - Cursor jumping up and down

I have a UITextView wrapped inside a UIViewRepresentable. Whenever I edit text inside the view which is binded to a swiftui with a string state variable, the cursor jumps up around 100px and then ...
Karl Ehrlich's user avatar
0 votes
1 answer
66 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 ...
dtrognn's user avatar
  • 26
0 votes
0 answers
22 views

how to vertically center image in UIScrollView ? apple swift to pan zoom using UIViewRepresentable

I am quite new to UIKit, and I have encountered a layout issue that's driving me crazy. my code is as follows, I want to create a view named ZoomableView which accepts an UIImage to pan & zoom. I ...
feiyuerenhai's user avatar
0 votes
0 answers
36 views

How do I fix the error with UIViewControllerRepresentable?

I got the error on my visionOS app saying that my view doesn't conform to UIViewControllerRepresentable. I tried this code in another visionOS project and it works. Is there anything I can dp? import ...
Raul's user avatar
  • 1
0 votes
1 answer
75 views

No ObservableObject of type found. A View.environmentObject(_:) for "ClassName" may be missing

ToggleView is unable to access the manager class environment object I have fully identified the cause of the crash to be because of my attempt in trying to access an environment object when presenting ...
User95797654974's user avatar
1 vote
1 answer
52 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 ...
thadae's user avatar
  • 13
1 vote
1 answer
61 views

UITextView weird behavior

I just wrote this SwiftUI or UiKit Editor with basic line numbers. I works pretty well, but has a major flaw. Whenever the variable behind the text value changes the editor messes up. This is pretty ...
Karl Ehrlich's user avatar
1 vote
0 answers
73 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, ...
shinking's user avatar
0 votes
0 answers
27 views

dyld: Symbol not found: VisionKit32ImageAnalysisInteractionDelegate

My project was running fine on Xcode 14.x. It's also running fine with Xcode 15.x and iOS 17. But without making any changes, I'm getting a crash on startup and this error with Xcode 15.x and iOS 16: ...
fer0n's user avatar
  • 986
0 votes
0 answers
36 views

Custom WebView With Loading Indicator - Infinite Reload Cycle

I created the below custom WebView for my app - the goal is to show a loading indicator until the content is loaded successfully. Everything works fine when // if isLoading { // ...
Alk's user avatar
  • 5,507
0 votes
0 answers
41 views

Updating RazorPayment Error, Success using UIViewrepresentable not working

I am implementing razorpayment in my SwiftUI app. I am using UIviewReprsentable to implement razorPayment. I have created struct RazorPayView: UIViewControllerRepresentable{..code..} to open the ...
Joji's user avatar
  • 33
0 votes
1 answer
120 views

How to I wrap a UIKit view in SwiftUI with a delegate callback requiring a return value?

The concrete usecase is that I want to wrap a ARSCNView in UIViewRepresentable. The thing is, I want to expose the ARSCNView's following properties: .delegate .session.delegate .session.delegateQueue ...
horseshoe7's user avatar
  • 2,817
0 votes
1 answer
165 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 ...
biggreentree's user avatar
  • 1,715
0 votes
2 answers
401 views

SwiftUI: Cannot show alert with WKWebView and WebView: UIViewRepresentable

I need a way to understand why I cannot show alert messages in swiftui for this code, I'd like to show alert if something happens while loading web page (also monitoring cookies, but is another task) ...
biggreentree's user avatar
  • 1,715
1 vote
0 answers
104 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 ...
Jayant Badlani's user avatar
1 vote
0 answers
96 views

SwiftUI Webview using WKWebView is crasing with EXC_BREAKPOINT

I have written a webview using UIViewRepresentable and WKWebView in SwiftUI. The app is currently published in the app store. For some users, the app is crashing and we are not able to reproduce it. ...
Santanu's user avatar
  • 11
0 votes
0 answers
63 views

AdMob rewardedInterstitial in SwiftUI with UIViewControllerRepresentable . . updateUIViewController triggered too many times

I am having issues in my SwiftUi app when trying to show adMob ad. I was following instructions on official site and came up with this View, that should display ad. import GoogleMobileAds import ...
Gregor Sotošek's user avatar
0 votes
0 answers
500 views

how to make work WKWebView and UIViewRepresentable in swiftui on some pages?

I'm trying to achieve a working WKWebView in SwiftUI, but have some issues, some on navigation not present for an android developer colleague: I cannot disable/enable back and forward buttons if I am ...
biggreentree's user avatar
  • 1,715
0 votes
0 answers
112 views

How to make UIScrollView and SwiftUI canvas not have blurry text on zoom?

SwiftUI's ScrollView does not natively support zooming, so I have to use a UIScrollView for zooming in on a canvas. I implemented a UIScrollView, with some minor changes to how bounds work, to this ...
1ctinus's user avatar
  • 65
0 votes
2 answers
150 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 ...
viteknow's user avatar
0 votes
0 answers
22 views

How to pass data from UIViewControllerRepresentable to parent SwiftUI view? (toy example inside) [duplicate]

Toy example: We define a view to be 200 width X 200 height. Inside will be a video player. However, we don't know the video that might be loaded. It could be 16:9, 3:4, 1:1 etc. When we load our view ...
chris P's user avatar
  • 6,529
0 votes
0 answers
134 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 ...
stompy's user avatar
  • 285
0 votes
0 answers
97 views

no Preview in usage of WKWebView and UIViewRepresentable in SwiftUI - solved

Why I am not getting a preview with this code? This code is working on physical device, but I cannot get preview for none of my views (ignore code about persistent data, I'm not using it at this ...
biggreentree's user avatar
  • 1,715
1 vote
0 answers
71 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 ...
sharanabasappa sugoor's user avatar
2 votes
0 answers
162 views

Using UIViewRepresentable for a TextField to hide the keyboard also hides keyboard outside my app in general iOS

I have created my own custom keyboard in my iOS swift app, and it works very good. But because i'm using a custom keyboard, i wanted to hide the normal iOS keyboard. I found a solution for this, by ...
frigsfrogs's user avatar
2 votes
1 answer
559 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, ...
batman's user avatar
  • 2,375
0 votes
0 answers
180 views

UIViewRepresentable creating new instance on state change

I'm new to Swift/UIKit and am trying to implement a MapLibreGL map that displays a list of markers. As the user changes search criteria, the list of markers changes, and I'm struggling to update the ...
Charlie Walker's user avatar
0 votes
2 answers
316 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 ...
Jason Eveleth's user avatar
3 votes
2 answers
599 views

Observing @State var changes from UIViewRepresentable in SwiftUI View

I have the following Swift view: struct GameView: View { @State private var userWon: Bool = false { didSet { print("userWon: \(userWon)") // not called // ...
batman's user avatar
  • 2,375
0 votes
0 answers
246 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 = ...
irrbloss's user avatar
  • 465
1 vote
0 answers
332 views

Detect when picker is opened when tapping on a textfield

I'm trying to implement a textField that opens a menu style picker when you tap on it. One of the requirements is to be able to detect when the picker is opened/closed and perform custom actions to ...
iamarnold's user avatar
  • 715
0 votes
1 answer
443 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 ...
batman's user avatar
  • 2,375
1 vote
1 answer
1k views

SwiftUI - Updating a UIView wrapped in a UIViewRepresentable with a @Published var from a ViewModel?

So basically I'm wrapping a pretty simple UIKit component for it to be used within a SwiftUI view. Context goes as follows: The component expects a UIImage as a parameter in its initializer but I ...
stompy's user avatar
  • 285
1 vote
0 answers
114 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 ...
Nuhash Haque's user avatar
1 vote
2 answers
231 views

SwiftUI UIViewRepresentable VideoPlayer updateUiView function causes infinite loop

I'm trying to implement a custom video player by using UIViewRepresentable. I have the following implementation: class PlayerUIView: UIView { var videoName: String private let playerLayer = ...
Marcel's user avatar
  • 502
0 votes
0 answers
106 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: ...
Ghemma Garay's user avatar
2 votes
1 answer
316 views

SwiftUI PDFView do not update when documentURL changes

I try to make simple pdf viewer in swiftui. When I choose pdf using fileImporter for a first time it shows but when I do it for a secound time it do not change even if .navigationTitle changes. I ...
DawPac's user avatar
  • 29
0 votes
1 answer
516 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 ...
DeveloperSammy's user avatar
1 vote
2 answers
19k views

SwiftUI Formatting TextField for credit card input "xxxx-xxxx-xxxx-xxxx"

I want to write a custom TextField on SwiftUI to have an input with credit card format like this "xxxx-xxxx-xxxx-xxxx", I was looking at this answers https://stackoverflow.com/a/48252437, ...
Arturiusz Pająk's user avatar
0 votes
1 answer
368 views

UIViewRepresentable get data back to Swiftui without calling update view

I'm implementin ARKit and RealityKit, from ARKit I need the estimated light and that value has to goes back to the swiftui view. But as I'm doing each time the swiftui view is redrawn also in the ...
Nicola Rigoni's user avatar
-1 votes
1 answer
749 views

How can I make my SwiftUI wrapper respect UIView size across all iOS versions?

I'm currently working on a SwiftUI wrapper for UIView and UIViewController, and my aim is to make this wrapper respect the size of the UIView and constraints. For now, I have successfully implemented ...
Данил Войдилов's user avatar
0 votes
1 answer
50 views

NSUnknownKeyException when connecting property IB

I am trying to integrate a UIKit view into my SwiftUI project using UIViewRepresentable as an intermediate. A TestViewVC.swift file was created containing just a simple IBOutlet: import Foundation ...
keith.g's user avatar
  • 930
3 votes
0 answers
162 views

Creating a PKCanvasView in swiftUI makes the screen flickers

I have a SwiftUI view that uses a PKCanvasView However, I am receiving an error in the logs 2023-05-07 01:06:14.413211-0700 [24247:15704822] Metal API Validation Enabled 2023-05-07 01:06:16.157795-...
Blacksmith's user avatar
1 vote
1 answer
386 views

UIViewRepresentable: Cannot use mutating member on immutable value: 'self' is immutable

I want to create a custom textfield for SwiftUI by using UIViewRepresentable. To handle the didBeginEditing and didFinishEditing actions I subscribed to the publishers that I previously created as an ...
Heimdallr's user avatar
  • 229
1 vote
0 answers
216 views

Why doesn't my UIViewRepresentable button handle VoiceOver tap actions?

I am trying to reuse a custom UIKit control in a SwiftUI screen, so I have wrapped it in a UIViewRepresentable struct. However, it does not respond to accessibility tap gestures (double-tap while ...
Greg's user avatar
  • 10.7k
2 votes
1 answer
220 views

SwiftUI hyperLink with UIViewRepresentable

I am trying to create HyperLink with UITextView in UIViewRepresentable but I can't see any text in UITextView. Using: ArtieHyperLink(url: "https://www.google.com.tr", text: "This is ...
Ufuk Köşker's user avatar
1 vote
2 answers
776 views

Swiftui UIViewRepresentable - How to update PKCanvasView image when imageData source is changed on user action

I am creating a SwiftUI app with PencilKit & UIViewRepresentable. I am adding a image coming from server on top of the PKCanvasView. Code works fine when I click on a image and open a canvas view ...
Swapster's user avatar

1
2 3 4 5 6