Post

Replies

Boosts

Views

Activity

Reply to No exact matches in call to instance method 'appendInterpolation' issue
private var ads: [AdInfo] = AdInfo.allAds the other part to that is : struct AdInfo: Codable { var aid, bname, bcity: String? var bstate: Bstate? var distance: String? var cangap: String? var vip: Int? var photo: [String: String]? var adsTitle, adsMsg, status: String? var urgentAdsHTML: [AdInfo]? enum CodingKeys: String, CodingKey { case aid, bname, bcity, bstate, distance, cangap, vip, photo case adsTitle = "ads_title" case adsMsg = "ads_msg" case status, urgentAdsHTML } static let allAds: [AdInfo] = Bundle.main.decode(file: "sanantoniotx.json") static let sampleAd: AdInfo = allAds[0] }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’23
Reply to Not able to decode JSON
Thank you for the help. When I did the do-catch the code is now functioning. do { let loadedData = try decoder.decode(T.self, from: data) return loadedData } catch { print("Decoding error: \(error)") fatalError("Could not decode \(file) from bundle.") }
Topic: App & System Services SubTopic: General Tags:
Jul ’23