Post

Replies

Boosts

Views

Activity

Reply to The given data was not valid JSON.
The key line is: let decodedData = try JSONDecoder().decode(DetailResponse.self, from: recepieData) ...where you try to decode a DetailResponse from json. struct DetailResponse:Codable {     let yields:String     let name:String } If you can share some sample json (that is failing to decode), then it will be possible to comment on what might be going wrong.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’21
Reply to Sequential execution of asynchronous functions. How?
You may have got a bit confused, between Operations and OperationQueue. Start simple: let operation1 = BlockOperation {     Thread.sleep(forTimeInterval: 5) print("Operation 1 completed") } let operation2 = BlockOperation { print("Operation 2 completed") } operation2.addDependency(operation1) let queue = OperationQueue() queue.addOperation(operation1) queue.addOperation(operation2)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’21
Reply to The given data was not valid JSON.
I think it's worse than Scott suggests, your JSON seems to be very badly formed. It's missing separators between items, and some of the items are ambiguous. This works: { "name":"Vegan ****** Cashew Mac", "yields":"Servings: 6" } Maybe you have chopped up your JSON, and posted something quite different to the original data?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’21
Reply to Markdown in Xcode 12.5.1
Put the comment above the function declaration! /// this is just an example of markdown. /// /// - Parameters: ///     - someString: A simple string. ///     - someInteger: A simple integer func myFunction(someString: String, someInteger: Int) {
Aug ’21