title: How to sort list in SwiftUI using JSON
body: <p>I have a list that I need to sort by "popularity" (more popular to less popular), this value comes from a JSON API. Is there a Sort function by given value in SwiftUI?</p>
  
  <p>The JSON looks like this:</p>
  
  <pre><code>[
  {
      "id": 1,
      "nombre": "The design of every day things",
      "autor": "Don Norman",
      "disponibilidad": true,
      "popularidad": 70,
      "imagen": "https://images-na.ssl-images-amazon.com/images/I/410RTQezHYL._SX326_BO1,204,203,200_.jpg"
  },
  {
      "id": 2,
      "nombre": "100 años de soledad",
      "autor": "Garcia Marquez",
      "disponibilidad": false,
      "popularidad": 43,
      "imagen": "https://images-na.ssl-images-amazon.com/images/I/51egIZUl88L._SX336_BO1,204,203,200_.jpg"
  }
  ]
  </code></pre>
  
  <p>There's more to it, that's just a piece of it.
  Popularity is <code>popularidad</code>.</p>
  
  <p>This is currently my list:</p>
  
  <pre><code>var body: some View {
      NavigationView {
          ScrollView {
              VStack(alignment: .leading) {
                  ForEach(booksVM.books) { book in
                      HStack {
                          Text(book.nombre)
                          Spacer()
                      }
                      Text(book.autor)
                      Spacer()
                  }
              }.padding(.leading, 5)
          }
      .navigationBarTitle("Bienvenido a la librería flux")
      .onAppear(perform: self.booksVM.fetchBooks)
      }
  }
  </code></pre>
  
  <p>Please let me know if more code is needed to understand this.</p>