Questions tagged [uihostingcontroller]
78 questions
2
votes
0 answers
SWIFTUI Tabview makes me long press after embedding in UiHostController, how do I stop this?
I am adding a SwiftUi view to my story board via UIHostController. The integration works and I have full functionality of buttons and image taps, however the Tabview at the bottom of the screen requires a long press in order for the Tabview to work…

newbycoder
- 51
- 6
2
votes
0 answers
SwiftUI Alert not presenting in View contained in UIHostingController in iOS14?
I have a SwiftUI View that is presented by UIKit and is contained within a UIHostingController. This View has a button that should trigger an Alert to be presented. My implementation is straightforward. Here is an example:
struct ContentView: View…

andrew
- 31
- 1
2
votes
0 answers
UIHostingController resets custom leftBarButtonItem when pushed
I have a view controller in a navigation controller. In viewDidLoad:
let button = UIButton()
button.setImage(Theme.Icon28.back.withRenderingMode(.alwaysTemplate), for: .normal)
button.addTarget(self, action: #selector(didTapBackButton), for:…

Kex
- 8,023
- 9
- 56
- 129
2
votes
1 answer
How to use Hosting Controller for SwiftUI in existing Storyboard Tab Bar Controller?
I'm trying to use a Hosting Controller to include a SwiftUI View in an existing Storyboard Tab Bar Controller. I already connected a Hosting View Controller to the Tab Bar Controller on Storyboard using the Relationship Segue. Below is what I…

Ryan Kanno
- 105
- 8
2
votes
1 answer
SwiftUI: pass view information to UIKit
I have a UIKit and AppKit app, and I am displaying a SwiftUI view within it via UIHostingController / NSHostingController. The view has some buttons on it, and I want to pass back the tap event back to a UIKit/AppKit view controller to show…

Z S
- 7,039
- 12
- 53
- 105
2
votes
2 answers
How to navigate back to UIViewController from SwiftUI View?
I'm using SwiftUI 1.0 in all my views starting from MainView which is the Home screen other than the Login as I'm using a client LoginSDK which is made via UIKit.
So in LoginViewController, I'm able to push the MainView() on sucessful login with…

Josh Byanec McFergan
- 441
- 8
- 21
2
votes
1 answer
Using SwiftUI Views for UICollectionViewCell inside a UIViewRepresentable CollectionView (Wrapped UICollectionView)
I have to replace an existing SwiftUI List of views with a UICollectionView(because the app designs were updated and the new designs are pretty complex for SwiftUI so it that had to be implemented as a custom UICollectionViewFlowLayout)
So the…

Pulkit Vaid
- 103
- 1
- 8
2
votes
0 answers
How to find the current visible controller for SwiftUI HostingController from AppDelegate?
I am working on a project where initial screens are in SwiftUI and further flow is in UIKit controllers. My problem is I want to know the visibleController on the screen or UINavigationController of the navigation stack when any of the appDelegate…

Hyder
- 139
- 1
- 10
2
votes
0 answers
Adding a SwiftUI CalloutView into MapKit
How do i add a custom calloutView for MapKitAnnotations written in SwiftUI?
I currently have this Code:
import SwiftUI
import MapKit
import CoreLocation
import UIKit
struct MapView: UIViewRepresentable {
@Binding var userTrackingMode:…

Clebo Sevic
- 581
- 1
- 7
- 17
1
vote
0 answers
How to enable working FocusState with UIKit
In out project we use SwiftUI as View layer working with UIKit for navigation.
When view created with UIHostingController TextFields don't reacts to @FocusState property wrapper. If create similar example as on screenshot in full SwiftUI project…

Zhenya Taran
- 11
- 3
1
vote
1 answer
SwiftUI View @State variables not updating when using Hosting controller
I have a SwiftUI app that uses UIViewControllerRepresentable to show a UIViewController. And the view controller uses a hosting controller to show a SwiftUI view inside it.
RoomView (SwiftUI file)
struct RoomView: View {
var body: some View…

Abdullah Ajmal
- 431
- 5
- 17
1
vote
0 answers
Navigation bar button appears with delay in mixed UIKit and SwiftUI project
I have an app which main framework was developed using uikit, and some of its pages were written by SwiftUI and embedded into uikit for display through UIHostingController. Now there is a Swiftui page, and I want to push to this page by…

mars
- 109
- 5
- 21
1
vote
0 answers
FocusState is now work in UINavigationController with UIHostingController
I have an app which main framework was developed using uikit, and some of its pages were written by SwiftUI and embedded into uikit for display through UIHostingController. Now there is a Swiftui page with TextField, and I want to listen for changes…

mars
- 109
- 5
- 21
1
vote
0 answers
SwiftUI - How do I prevent the white background from showing when the keyboard is dismissed in a NavigationStack?
The view hierarchy is as follow:
UITabBarController -> UIHostingController -> NavigationStack -> View -> ScrollView
When the keyboard is displayed and dismissed it does not use the same timing curve as the scroll view re-adjusting itself and there…

price
- 43
- 1
- 6
1
vote
0 answers
SwiftUI: Prevent Text from expanding view outside available bounds
I'm encountering an issue where Text, depending on its contents, is causing the SwiftUI view to grow larger than the available space rather than wrapping a word to another line. I think it's just a bug (FB11809780) but I'm interested in finding a…

Jordan H
- 52,571
- 37
- 201
- 351