Post

Replies

Boosts

Views

Activity

Reply to Help wanted for newbie
There's a lot going on in your sample code, so you need to narrow down where the issue is. It looks like you may have multiple issues, so you may want to start with simpler code first? Some points to consider: Are you successfully creating a valid GKCoordinate? If so, are you getting a valid WGS coordinate from it? A SwiftUI array-based List requires that each element is uniquely identifiable. Your coordinates may not be uniquely identifiable (since the user could enter the same values more than once. Why store the coordinate values as string, and then re-scan them to numbers... why not just store them as coordinates? (Could there be an error in either side of this conversion process?) Are you passing a valid coordinate to showinMaps? Are you passing a valid MKMapItem to Maps?
Mar ’23
Reply to Storyboard in Xcode
Some people prefer using Storyboard and constraints - if you don't like it, you have the option of not using it. Existing projects which use the Storyboard may continue to exist for many years, and Apple must support this. Xcode is very flexible - use the features you want, and ignore the others.
Dec ’22
Reply to Cannot Parse JSON data
Your json is formatting dates like "11.12.2022", which is MM.dd.yyyy You need to provide this format to your JSONDecoder. I generally use a DateFormatter extension for this: extension DateFormatter { static let jsonDateFormatter: DateFormatter = { let formatter = DateFormatter() formatter.locale = Locale.autoupdatingCurrent formatter.dateFormat = "MM.dd.yyyy" return formatter }() } Then you simply pass this to your JSONDecoder, like this: do { let decoder = JSONDecoder() decoder.dateDecodingStrategy = .formatted(DateFormatter.jsonDateFormatter) return try decoder.decode(T.self, from: data) }
Nov ’22