uiviewrepresentable Questions

1

I tried to create a custom SwiftUI menu (based on UIMenu). However, I'm unable to trigger the primary action. It works when I tap on the CustomMenu but the programmatic action is not triggered. Wha...
Elsyelton asked 13/1, 2021 at 12:11

3

Solved

I'm trying to use my custom UIView in SwiftUI using UIViewRepresentable and I want my UIView to have the same size as I set in .frame() so that I can use it like this: MyViewRepresentable() .fram...
Luminescence asked 10/6, 2020 at 10:35

1

I'm getting really close to implementing dynamic height for a UITextView in SwiftUI. Please help me work out these kinks: The UITextView has the correct height when it appears but does not adjust...
Thorson asked 18/3, 2020 at 2:22

2

Solved

I have a map in a SwiftUI app. It is working up to a point; but now I want to be able to tap on it and know the latitude and longitude of the tap. Here is the current code: import SwiftUI import Ma...

1

Edit: Created a sample project illustrating the issue: https://github.com/Harold-D/PDFView_Representable Question: I'm at a lost, I have this very simple UIViewRepresentable wrapper around PDFView ...
Seafood asked 16/10, 2021 at 21:23

0

I'm trying to implement a lazy-loading MyLazyHStack view using UIViewRepresentable, but it's not loading the elements lazily. I'm using LazyHStack in the content of MyLazyHStack, but all the elemen...
Secure asked 27/3, 2023 at 20:25

4

Anyone know how to deal with this? Seems as though when you have a UIHostingController with a NavigationView the following happens: Notice the big grey tab bar safe area. This is primarily a UIKit...
Tadashi asked 12/1, 2021 at 20:29

4

Solved

The goal is to get a UILabel integrated via UIViewRepresentable to size the same way Text does - use the available width and wrap to multiple lines to fit all the text thus increasing the height of...
Itagaki asked 8/7, 2020 at 4:13

2

I'm wanting to use a SwiftUI View as content for a child UIView (which in my app would be inside UIViewController) by passing SwiftUI. However the SwiftUI View doesn't respond to state changes once...
Chelonian asked 5/3, 2020 at 8:15

2

Solved

I started to experiment SwiftUI stuff in a new clean project. Inside this new project, created a struct that conforms to UIViewRepresentable. The idea is to embed a UIKit view inside a SwiftUI view...
Chattanooga asked 11/12, 2020 at 10:52

1

Solved

I can't find a way to make a UIImageView wrapped in a UIViewRepresentable be sized to fit the frame. It always resizes beyond the screen no matter what content Mode or clipping or explcit framing I...
Ruthenious asked 23/6, 2022 at 14:36

2

I created a UIViewRepresentable to wrap UITextField for SwiftUI, so I can e.g. change the first responder when the enter key was tapped by the user. This is my UIViewRepresentable (I removed the ...
Zagreb asked 30/1, 2020 at 16:42

1

Solved

I'm trying to embed a SwiftUI View within a UIKit UIView, within a View again. It will look something like this: View ↓ UIView ↓ View Current code: struct ContentView: View { var body: some View ...
Report asked 15/2, 2022 at 13:37

1

I am using a boolean (searchVM.showSearchView: Bool) to simultaneously turn opacity of a SearchView to 1.0 AND show/hide a UIRepresentableKeyboard. This gives me the same functionality as Google Ma...
Casias asked 5/12, 2021 at 21:32

1

Using Swift 5.5, Xcode 13.0, iOS 15.0.1, Since Apple does not a good job on ScrollViews for SwiftUI (yet?), I had to implement my own zoomable ScrollView. See code below. I had it successfully runn...
Prawn asked 10/10, 2021 at 16:46

6

Solved

I'm trying to port WKWebView over to SwiftUI. Here's my code: import SwiftUI import WebKit struct ContentView: View { var body: some View { WebViewWrapper() } } /** WKWebView ported over to S...
Dayledaylight asked 9/12, 2020 at 20:54

4

Simplest example below. Works fine in preview (UITextView text updates to "ouch"). But, run it in an app (ie add as rootView by the sceneDelegate), and the UITextView doesn't update. impo...
Chappie asked 12/10, 2019 at 12:15

2

This view is a UIKit slider adapted to my SwiftUI project because in SwiftUI Slider cannot change its track color, which is probably a bug since you should be able to change it with .accentColor. A...
Boudreau asked 8/12, 2020 at 23:39

4

Solved

This is my first time working with PassKit and with SwiftUI on a big project. I'm trying to implement Apple Pay SwiftUI and since there isn't a native way to do so yet, I tried wrapped the PKPaymen...
Opportune asked 19/3, 2020 at 23:5

1

Solved

Currently, I am able to have a separate PKCanvasView and a PKToolPicker that is shown when a button is tapped on. However, the tool is not being transferred between the picker and the canvas view. ...
Overmuch asked 23/9, 2020 at 0:33

3

Solved

When running my SwiftUI & SpriteKit app, I get the following messages in the logs: 2019-11-18 21:58:57.631912+0000 PixelBattles[2812:1215803] SKView: ignoreRenderSyncInLayoutSubviews is N...
Afghan asked 18/11, 2019 at 22:13

2

Solved

I would like to have a SwiftUI view that shows many lines of text, with the following requirements: Works on both macOS and iOS. Shows a large number of strings (each string is backed by a separa...

2

Solved

I'm trying to update the colour of an SKEmitterNode within a UIViewRepresentable. The hue value is passed in from the state on the parent View, and the emitter colour should update when the hue val...
Kaseykasha asked 15/9, 2019 at 22:11

1

Solved

I am using SwiftUI and bridge to UITextField (I need to assign firstResponder). I use the code from here: SwiftUI: How to make TextField become first responder? The following code updates my @Bind...
Phagocyte asked 5/12, 2019 at 9:42

1

Solved

I created a UIViewRespresentable for a UITextField. I'd like to apply modifiers: myTextField.font(.headline).keyboardType(keyboardType) This is not working, even if my UIViewRepresentable is sim...
Jeopardous asked 12/11, 2019 at 21:6

© 2022 - 2024 — McMap. All rights reserved.