swiftui

Mapview shows White overlay on Interaction

吃可爱长大的小学妹 提交于 2021-02-10 05:46:09
问题 I am using GMSMapView with SwiftUI, in map-view I have to display some markers with lat and long. Upon clicking any marker I have to Move to another view. I am doing this by putting MapView in NavigationLink . This thing is working fine By using code. NavigationView { NavigationLink(destination: Text(""), isActive: $abc) { MapView().edgesIgnoringSafeArea(.all) } } And the issue is NavigationLink , after putting mapview in NavigationLink every-time when i interact with map, white overlay

How to integrate Mapbox SDK with SwiftUI

ぃ、小莉子 提交于 2021-02-10 05:36:26
问题 I installed the Mapbox SDK into my project, but I don't understand how to integrate this code snippet with SwiftUI . I created a SwiftUI View named MapView , where I import the Mapbox Framework. I try to use the UIViewRepresentable protocol, as in Apple's tutorial, but without success. import Mapbox class MapView: UIViewController { override func viewDidLoad() { super.viewDidLoad() let styleURL = URL(string: "mapbox://styles/mapbox/outdoors-v9") let mapView = MGLMapView(frame: view.bounds,

Pass GestureState property down through an ObservableObject

我只是一个虾纸丫 提交于 2021-02-10 04:15:48
问题 I have an ObservableObject that has a member property with the @GestureState wrapper. In my View, how do I get access to the GestureState property? I've already tried using dot notation with the $ binding to try to expose the GestureState but it doesn't like that My AppState ObservableObject : class AppState: ObservableObject { let objectWillChange = ObservableObjectPublisher() @GestureState var currentState: LongPressState = .inactive public enum LongPressState: String { case inactive =

SwiftUI issue on iOS 14 with Scrollview HStack content being cut off

不想你离开。 提交于 2021-02-09 11:10:55
问题 I have a list of buttons that display perfectly on iOS 13 using SwiftUI, but on iOS 14 it cuts the content off where the screen ends. Has anything changed with regards to how HStacks renders what isn't on the screen? I used to scroll and be able to see all the buttons. I will attach some screenshots and the code. var body: some View { VStack(alignment: .leading, spacing: 0){ Text("Select a venue type") .font(.custom("MavenProBold", size: 16)) .padding(.leading, 16) .padding(.top, 18)

SwiftUI issue on iOS 14 with Scrollview HStack content being cut off

纵饮孤独 提交于 2021-02-09 11:07:44
问题 I have a list of buttons that display perfectly on iOS 13 using SwiftUI, but on iOS 14 it cuts the content off where the screen ends. Has anything changed with regards to how HStacks renders what isn't on the screen? I used to scroll and be able to see all the buttons. I will attach some screenshots and the code. var body: some View { VStack(alignment: .leading, spacing: 0){ Text("Select a venue type") .font(.custom("MavenProBold", size: 16)) .padding(.leading, 16) .padding(.top, 18)

How to properly include “Add Item” button in a NavigationView using SwiftUI?

为君一笑 提交于 2021-02-09 09:25:09
问题 I need a "Plus" ⊕ Button in my NavigationView 's List .navigationBarItems (right on the navigation bar), which I'd like to add a row to the list, using a subsequent view in the navigation hierarchy to enter its name etc. But first, I can't even get the button to navigate correctly! When I tap it in the Preview Canvas, the button's operation seems to work. Yet in an actual app, while it does navigate to my destination View, when I tap that View's "< Back" button, the app crashes with:

How to properly include “Add Item” button in a NavigationView using SwiftUI?

寵の児 提交于 2021-02-09 09:23:06
问题 I need a "Plus" ⊕ Button in my NavigationView 's List .navigationBarItems (right on the navigation bar), which I'd like to add a row to the list, using a subsequent view in the navigation hierarchy to enter its name etc. But first, I can't even get the button to navigate correctly! When I tap it in the Preview Canvas, the button's operation seems to work. Yet in an actual app, while it does navigate to my destination View, when I tap that View's "< Back" button, the app crashes with:

SwiftUI custom list with ForEach delete animation not working

早过忘川 提交于 2021-02-09 06:54:38
问题 I am creating a custom list displaying time information (minutes and seconds, not used in the snippet below to simplify the code). I managed to implement a nice animation when the user adds an entry to the list, but deleting an entry has no animation (1st GIF). With iOS 14, the animation is working, however, the animation only removes the last rectangle from the list and then updates the text in each row (2nd GIF). That's not what I want - My goal is if a row has been deleted, the other rows

SwiftUI - how to avoid row indenting in List when in Edit Mode, but not using onDelete? (code/video attached)

依然范特西╮ 提交于 2021-02-08 15:16:26
问题 In SwiftUI how can I avoid having row content being indenting in my List when I move into Edit Mode, but not using onDelete? That is currently my row content is indented as this happens, as if the "delete" button will be shown on the left, however I'm not using onDelete so there is no button there. Animated GIF Code extract here: var body: some View { VStack{ List() { ForEach(gcTasks) { gcTask in HStack { GCTaskRow(withGcTask: gcTask, haha: "") } } // .onDelete(perform: self.deleteTask) //

SwiftUI - how to avoid row indenting in List when in Edit Mode, but not using onDelete? (code/video attached)

自古美人都是妖i 提交于 2021-02-08 15:15:39
问题 In SwiftUI how can I avoid having row content being indenting in my List when I move into Edit Mode, but not using onDelete? That is currently my row content is indented as this happens, as if the "delete" button will be shown on the left, however I'm not using onDelete so there is no button there. Animated GIF Code extract here: var body: some View { VStack{ List() { ForEach(gcTasks) { gcTask in HStack { GCTaskRow(withGcTask: gcTask, haha: "") } } // .onDelete(perform: self.deleteTask) //