How To Get Rid Of Boringss Logs | Apple Developer Forums

  • Global Nav Open Menu Global Nav Close Menu
  • Apple Developer
Search
  • Apple Developer
  • News
  • Discover
  • Design
  • Develop
  • Distribute
  • Support
  • Account
Only search within “”

Quick Links

5 Quick Links Developer Forums Search for a topic, subtopic, or tag Clear search query Local Nav Open Menu Local Nav Close Menu
  • Search
Post Profile
  • Sign in
  • Create account
How to get rid of boringss logs Programming Languages Swift Swift You’re now watching this thread. If you’ve opted in to email or web notifications, you’ll be notified when there’s activity. Click again to stop watching or visit your profile to manage watched threads and notifications. You’ve stopped watching this thread and will no longer receive emails or web notifications when there’s activity. Click again to start watching. caroline17 OP Created Aug ’22 Replies 0 Boosts 0 Views 287 Participants 1

So I make this function to fetch data from the url

class Api : ObservableObject{   @Published var movies = [MovieEntry]()       func loadData() async {     guard let url = URL(string: "https://imdb-api.com/en/API/MostPopularMovies/[apikey]") else {       print("Invalid URL")       return     }           do {       let (data, _) = try await URLSession.shared.data(from: url)       if let decodedResponse = try? JSONDecoder().decode(Movies.self, from: data) {         movies = decodedResponse.items       }     } catch {       print("Invalid data")     }   } }

Then, I try to show the data in a list

struct ContentView: View {       @State private var movies = [MovieEntry]()       var body: some View {     List(movies, id: \.id) { movie in       Text("\(movie.fullTitle)")     }     .task {       await Api().loadData()     }   } }

But I got the following error and the data didn't show

Is there something wrong with my code? I have tested the url and it works just fine

Boost Copy to clipboard Share this post Copied to Clipboard Replies 0 Boosts 0 Views 287 Participants 1 How to get rid of boringss logs First post date Last post date Q

Tag » How To Get Rid Of Logs