UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Day 52 Challenge 3 - strange error

Forums > 100 Days of SwiftUI

I'm getting a very strange error every time I try to place the order. This is what the console says :

nw_protocol_get_quic_image_block_invoke dlopen libquic failed

I've tried comparing my code to what others have posted online but i don't see what I'm doing wrong...

Here's my checkout view:

import SwiftUI

struct CheckoutView: View {

    func placeOrder(){
        guard let encoded = try? JSONEncoder().encode(orderC.orderS) else {
            print("Failed to encode order")

        let url = URL(string: "https://reqres.in/api/cupcakes")!
        var request = URLRequest(url: url)
        request.setValue("application/json", forHTTPHeaderField: "Content-Type")
        request.httpMethod = "POST"
        request.httpBody = encoded

        URLSession.shared.dataTask(with: request){ data, response, error in

            guard let data = data else{
                print("No data in response: \(error?.localizedDescription ?? "Unknown Error").")
                let message: String = error?.localizedDescription ?? "Unknown error occured"
                self.errorMessage = message
                self.showingError = true

            if let decodedOrder = try? JSONDecoder().decode(OrderS.self, from: data){
                self.confirmationMessage = "Your order for \(decodedOrder.quantity) x \(OrderS.types[decodedOrder.type].lowercased()) cupcakes is on its way!"
                self.showingConf = true
            } else {
                print("Invalid response from server")



    @State private var confirmationMessage = ""
    @State private var showingConf = false

    @State private var errorMessage = ""
    @State private var showingError = false

    @ObservedObject var orderC: OrderC
    var body: some View {

        GeometryReader{ geo in

                        .frame(width: geo.size.width)

                    Text("Your order total is: $\(orderC.orderS.cost, specifier: "%.2f")")

                    Button("Place order"){

        }.navigationBarTitle("Checkout", displayMode: .inline)
        .alert(isPresented: $showingConf){
            Alert(title: Text("Thank you!"), message: Text(confirmationMessage), dismissButton: .default(Text("OK")))
        .alert(isPresented: $showingError){
            Alert(title: Text("Error"), message: Text(errorMessage), dismissButton: .default(Text("OK")))


struct CheckoutView_Previews: PreviewProvider {
    static var previews: some View {
        CheckoutView(orderC: OrderC())

and here's my Order class and struct:

class OrderC: ObservableObject{

    @Published var orderS = OrderS()


struct OrderS: Codable {

        static var types = ["Vanilla", "Chocolate", "Strawberry", "Rainbow"]

        var type = 0
        var quantity = 3
        var specialRequestEnabled = false{
                if specialRequestEnabled == false{
                    self.extraFrosting = false
                    self.addSprinkles = false

        var extraFrosting = false
        var addSprinkles = false

        var name = ""
        var streetAddress = ""
        var city = ""
        var zip = ""

        var hasValidAddress: Bool {

            let nameed = name.trimmingCharacters(in: .whitespacesAndNewlines)
            let added = streetAddress.trimmingCharacters(in: .whitespacesAndNewlines)
            let cityed = city.trimmingCharacters(in: .whitespacesAndNewlines)
            let ziped = zip.trimmingCharacters(in: .whitespacesAndNewlines)

            if nameed.isEmpty || added.isEmpty || cityed.isEmpty || ziped.isEmpty {
                return false
            return true

        var cost: Double{

            var cost = Double(quantity) * 2

            cost += (Double(type) / 2)

            if extraFrosting{
                cost += Double(quantity)

            if addSprinkles{
                cost += (Double(quantity) / 2)

            return cost

    init() { }



There is another related question (for the same error) - here

Maybe that will help.

Seems to be, from what I read, that for the moment it is possible to ignore the error.


Thank you! I can't seem to get the app to run properly though... Nothing happens when I click the 'place order' button, and then this error shows up in the console. I'n not sure what part of my code is wrong...


@7elysium, did you solve this Challenge 3? Anybody chime in here? Would really appreciate some help. I also made a post about Project 10 Challenge 3. Thanks.


BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.