Questions tagged [uiviewcontrollerrepresentable]
75 questions
5
votes
1 answer
How to use EnvironmentObject in UIKit ViewController
I'm building a SwiftUI app that wraps UIKit ViewController through UIViewControllerRepresentable. The goal is to display a UITextView in my SwiftUI app. The implementation of this is simple, like this:
// iOSTextView.swift
import SwiftUI
struct…

Sami Almalki
- 588
- 2
- 17
5
votes
2 answers
SwiftUI Game Center authentication doesn't prompt user to login
I have the below code to authenticate a local player in Game Center in my SwiftUI app. I want Game Center to prompt user to login if the player is not already login in but this doesn't happen.
class AppSettings: UINavigationController {
func…

Heyman
- 449
- 4
- 13
4
votes
4 answers
UIViewControllerRepresentable not correctly taking up space
I am trying to use a custom UIViewController in a SwiftUI view. I set up a UIViewControllerRepresentable class which creates the UIViewController in the makeUIViewController method. This creates the UIViewController and displays the button, however,…

Timmy
- 166
- 1
- 9
3
votes
1 answer
SwiftUI & UIViewControllerRepresentable - Found unexpected null pointer value while trying to cast value of type
I am trying to present a MFMailComposeViewController in my SwiftUI app an I get the error.
Found unexpected null pointer value while trying to cast value of type
'MFMailComposeViewController' (0x1272f5248) to…

RileyDev
- 2,950
- 3
- 26
- 61
3
votes
2 answers
SwiftUI How to share a URL to Facebook using FBSDKShareKit and ShareDialog?
I tried looking for a solution in posts such as this and this where people asked this very same question: How to share a url to Facebook using SwiftUI?
I even tried this post where somebody asked how to export a file using SwiftUI, but my problem is…

Nico Cobelo
- 557
- 7
- 18
3
votes
1 answer
MFMessageComposeViewController + SwiftUI Buggy Behavior
I'm using ViewControllerRepresentable to present a MFMessageComposeViewController so users can send texts from my app.
However, every time the view is presented, it's very buggy - elements randomly disappear, scrolling is off, and the screen…

bze12
- 727
- 8
- 20
3
votes
0 answers
Touches/Gestures in SwiftUI and UIView(Controller)Representable aren't recognised at the same time
I have controls inside both SwiftUI views as well as UIKit VCs and views that are embedded inside UIView(Controller)Representable. In my (music) app it's common for the user to interact with multiple controls at the same time, e.g. tweaking knobs or…

Nikolozi
- 2,212
- 2
- 19
- 29
3
votes
1 answer
Performance issues after using UIImagePickerController
I have a SwiftUI app that is using an image picker wrapped in UIViewControllerRepresentable using the .sheet modifier to display it.
Upon picking the image, the rest of the app more or less grinds to a halt until there is some kind of crash in the…

codewithfeeling
- 6,236
- 6
- 41
- 53
3
votes
1 answer
Compatibility between SwiftUI's large title navigation bar and UIViewControllerRepresentable UITableViewController
In order to implement swipe to right in SwiftUI List, I am trying to make UIViewControllerRepresentable UITableViewController.
However, it is not compatible with the navigation bar when the displayMode is .large.
I guess, when the scroll moves, it…

cancue
- 384
- 3
- 18
3
votes
1 answer
Access @Environment object from UIViewControllerRepresentable object
I used this approach to incorporate camera with swiftUI:
https://medium.com/@gaspard.rosay/create-a-camera-app-with-swiftui-60876fcb9118
The UIViewControllerRepresentable is implemented by PageFourView class. PageFourView is one of the TabView of…

Alina
- 61
- 5
3
votes
0 answers
Push NavigationController from a UIViewControllerRepresentable
I have a SwiftUI View that displays a UIViewControllerRepresentable which is wrapped in a NavigationView. I've gotten it all working to what I want though now I want to be able to push from the collection view another View when the user taps in a…

oalansari82
- 107
- 3
- 6
3
votes
1 answer
SwiftUI send action from a page to the PageViewController
I have set up a PageViewController in SwiftUI, following the known Tutorial Interfacing with UIKit, with UIViewControllerRepresentable etc.
My array of controllers consists of simple SwiftUI views. I pass a simple IntroPage struct to supply the…

Mundi
- 79,884
- 17
- 117
- 140
2
votes
1 answer
Porting UIDocumentPickerViewController into SwiftUI and I keep getting Error Domain=_UIViewServiceErrorDomain Code=1
Am porting over my UIDocumentPickerViewController into SwiftUI and whether I pick a file or cancel the picker I keep getting the error:
[DocumentManager] The view service did terminate with error: Error Domain=_UIViewServiceErrorDomain Code=1…

NewToSwiftUI
- 33
- 4
2
votes
1 answer
Working around a SwifUI layout bug involving UIViewControllerRepresentable
I have encountered a bug whenever UIViewControllerRepresentable is used within a SwiftUI view. I've filed a report to Feedback Assistant, but need to work around it to release my app.
import SwiftUI
struct ContentView: View {
var body: some…

Steve M
- 9,296
- 11
- 49
- 98
2
votes
2 answers
UICloudSharingController Does not Display/Work with CloudKit App
I have been struggling to get an app to work with CloudKit and record sharing. I have
created several apps that sync Core Data records among devices for one user. I have not
been able to get the UICloudSharingController to work for sharing records.…

JohnSF
- 3,736
- 3
- 36
- 72