Changing function with borders on specific sides to also be able to accommodate corner radius?

So I have the following struct and view extension to be able to add to any view, any ideas how to fix the corner of the view in the image below? extension View { func border(width: CGFloat, edges: [Edge], color: Color) -> some View { overlay(EdgeBorder(width: width, edges: edges).foregroundColor(color)) } } struct EdgeBorder: Shape { […]

By nickcoding
Published
Categorised as border, swift, swiftui Tagged , ,

URLRequest.addValue() causes SwiftUI calendar to revert date

The function below is called every 3 seconds and looks like: func fetchItems(){ let url = URL(string: itemUrl)! var request = URLRequest(url: url) request.httpMethod = "GET" request.addValue("Item (self.item)", forHTTPHeaderField: "Authorization") let task = URLSession.shared.dataTask(with: request, completionHandler: parseJasonObject) task.resume() } func parseJasonObject(data: Data?, urlResponse: URLResponse?, error: Error?){ guard error == nil else { print("error: (error!)") return […]

By nickcoding
Published
Categorised as datepicker, swift, swiftui, urlrequest Tagged , , ,

Keyboard offset no longer functions in SwiftUI 2

So I have an ObservableObject that sets a published variable ‘currentHeight’ to the height of the keyboard: import Foundation import SwiftUI class KeyboardResponder: ObservableObject { @Published var currentHeight: CGFloat = 0 var _center: NotificationCenter init(center: NotificationCenter = .default) { _center = center _center.addObserver(self, selector: #selector(keyBoardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil) _center.addObserver(self, selector: #selector(keyBoardWillHide(notification:)), name: UIResponder.keyboardWillHideNotification, object: […]

By nickcoding
Published
Categorised as keyboard, offset, swift, swiftui, xcode Tagged , , , ,

SwiftUI: compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions

So I have a GeometryReader encapsulating most of my contentView, struct ContentView: View { var body: some View { GeometryReader { proxy in …. } } } but I’m running into an issue with it. I pass it into various views in my ContentView with no issues. For some reason though, if I try to […]

Dynamic Links Firebase function not being called at all Xcode 12?

So I have a dynamic link that is working in that it opens up the app when I click on it but the handling of the dynamic link doesn’t happen. This is because application function seen below is never entered and I’m not sure why… func handleIncomingDynamicLink(_ dynamicLink: DynamicLink){ guard let url = dynamicLink.url else […]

Dealing with multiple annotations at the same address in an MGLMapView using SwiftUI and Mapbox

The thing is, I can’t find any documentation on this–does anyone know if there is a way to neatly deal with annotations in the same spot (either so that you can like click the annotation or a button to cycle through the annotations at that spot or something else)? I just need a way to […]

By nickcoding
Published
Categorised as mapbox, mglmapview, swift, swiftui Tagged , , ,

How to add onCommit, isEditing, and ability to have a custom binding to a custom textview?

What is the best way to give the below UIViewRepresentable isEditing and onCommit properties? I’d like it to have the same exact functionality on call of TextFields in SwiftUI (where you can add code for what to do when the return key is pressed [onCommit] or when the textfield is clicked [isEditing]) struct TextView: UIViewRepresentable […]

By nickcoding
Published
Categorised as swift, swiftui, textview, uiviewrepresentable Tagged , , ,

Weird Swift TextField glitch that might not have a solution?

so I have a fairly large file that defines the view of a search bar. I just spent the last two hours removing all of the excess/unnecessary code from the file. The error I’m having is that when I type pretty fast into the search bar, not every key that is pressed is registered, so […]

By nickcoding
Published
Categorised as mapbox, swift, swiftui

Error when I geocode an address (rare) in Swift

I have a SearchBar that updates a certain Binding string that is the geocoded into a list of potential location matches. Sometimes as I type in a location, I get the following: libswiftCore.dylib`_swift_runtime_on_report: -> 0x1054f7180 <+0>: pushq %rbp //Error on this line says “= Thread 1: Fatal Error: Duplicate keys of type ‘GeocodedPlacemark’ were found […]

By nickcoding
Published
Categorised as debugging, dictionary, swift, swiftui

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq