title: How can I change ObservedObject
body: <p><strong>*DataStoreCode:</strong>    </p>
  
  <p>How can I assign a variable to the parameter in the getTrailer function ?
  I can't send data to the parameter when I click and the link doesn't work</p>
  
  <pre><code>class DataStore: ObservableObject {
          @Published var movie: MovieRoot?
          @Published var trailer: TrailerRoot?
          @Published var url: String?
  
          init() {
              self.getMovies()
              self.getTrailers(url: url ?? "")
          }
  
          func getMovies() {
              JSONService().getMovies(url: "https://api.themoviedb.org/3/movie/upcoming?api_key=594b8eb4999a812345136ee3ed1ebdb&amp;language=tr-TR&amp;page=1", model: movie) { (result) in
                  self.movie = result
              }
          }
  
          func getTrailers(url: String) { //This parameter.
              JSONService().getMovies(url: url, model: trailer) { (result) in
                  self.trailer = result
              }
          }
      }
  </code></pre>
  
  <p><strong>My ContentView Codes:</strong></p>
  
  <pre><code>ForEach(store.movie?.results ?? []) { item in 
  VStack()
  .onTapGesture {
             self.show.toggle()
             self.store.url = "https://api.themoviedb.org/3/movie/\(item.id)/videos?api_key=594b8eb499123456ad5136ee3ed1ebdb&amp;language=en-US"
            print(self.store.trailer?.results)
          }
      }
  </code></pre>
  
  <p><strong>JSON Service</strong></p>
  
  <pre><code>class JSONService {
  
      func getMovies&lt;T: Decodable&gt;(url: String, model: T, completion: @escaping (T) -&gt; ()) {
          guard let url = URL(string: url) else { return }
  
          URLSession.shared.dataTask(with: url) { (data, response, error) in
  
              guard let data = data else { return }
  
              do {
                  let items = try JSONDecoder().decode(T.self, from: data)
                  DispatchQueue.main.async {
                      completion(items)
                  }
              } catch let error {
                  print(error)
              }
          }
          .resume()
      }
  }
  </code></pre>
  
  <p><strong>ContentView</strong></p>
  
  <pre><code>struct ContentView: View {
  
      @State var show: Bool
      //@State var movie: MovieRoot
      @ObservedObject var store = DataStore()
      @State var selectedMovie: Movie
      @State var id: Int
      var imageURL = "https://image.tmdb.org/t/p/w185_and_h278_bestv2"
      //var trailerURL = "https://api.themoviedb.org/3/movie/338762/videos?api_key=594b8eb4999a8b44ad5136ee3ed1ebdb&amp;language=en-US"
      var body: some View {
  
          ZStack {
  
              ScrollView(.horizontal, showsIndicators: false) {
                  HStack {
                      ForEach(store.movie?.results ?? []) { item in
                          GeometryReader { geometry in
                              VStack {
                                  //Image("film")
                                  WebImage(url: URL(string: self.imageURL + item.poster_path))
                                      .resizable()
                                      .retryOnAppear(true)
                                      .onSuccess()
                                      .renderingMode(.original)
                                      .cornerRadius(30)
                                      .frame(width: 185, height: 278)
                                      .shadow(color: Color.black.opacity(0.4), radius: 10, x: 0, y: 10)
                                      .animation(.spring(response: 0.5, dampingFraction: 0.6, blendDuration: 0))
  
                                  Text(item.title)
                                      .font(.system(size: 20, weight: .bold))
  
                                  CircleView(firstColor: #colorLiteral(red: 0.2392156869, green: 0.6745098233, blue: 0.9686274529, alpha: 1), secondColor: #colorLiteral(red: 0.8078431487, green: 0.02745098062, blue: 0.3333333433, alpha: 1), width: 50, height: 50, percent: item.vote_average)
                              }
                              .rotation3DEffect(Angle(degrees: Double(geometry.frame(in: .global).minX - 30) / -20), axis: (x: 0, y: 10.0, z: 0))
                              .frame(width: UIScreen.main.bounds.width)
                              .onTapGesture {
                                  self.show.toggle()
                  Here-&gt;          self.store.url = "https://api.themoviedb.org/3/movie/\(item.id)/videos?api_key=594b8eb4999a8b44ad5136ee3ed1ebdb&amp;language=en-US"
                                  print(self.store.trailer?.results)
                              }
                              .offset(y: self.show ? .zero : -UIScreen.main.bounds.height)
                              .animation(.easeIn)
                          }
                          .frame(width: UIScreen.main.bounds.width)
                      }
                  }
                  .frame(maxHeight: .infinity)
              }
  
              DetailView(show: $show, movie: $selectedMovie)
          }
  //        .onAppear {
  //            JSONService().getMovie(url: "https://api.themoviedb.org/3/movie/upcoming?api_key=594b8eb4999a8b44ad5136ee3ed1ebdb&amp;language=tr-TR&amp;page=1") { (result) in
  //                self.movie.results = result.results
  //            }
  //        }
      }
  }
  </code></pre>
  
  <p>How can I check that the url variable in the DataSource class has changed. I'm throwing item.id into the url variable, but it doesn't work.</p>
  
  <p>I redirect the data in Content View to the Detail View page.</p>
  
  <p><strong>DetailView</strong></p>
  
  <pre><code>struct DetailView: View {
      @ObservedObject var trailer = DataStore()
  
      @Binding var show: Bool
      @Binding var movie: Movie
      var body: some View {
  
          ScrollView(.vertical, showsIndicators: false) {
          VStack {
                  Image(systemName: "multiply.circle")
                      .imageScale(.large)
                      .padding()
                      .onTapGesture {
                          self.show.toggle()
                  }
                  .onDisappear()
  
                  WebView(request: URLRequest(url: URL(string: "https://www.youtube.com/watch?v=gn5QmllRCn4")!))
                      .frame(height: UIScreen.main.bounds.height * 0.3)
                      .background(Color(UIColor.secondarySystemBackground))
                      .cornerRadius(20)
                      .shadow(color: Color.black.opacity(0.3), radius: 10, x: 0, y: 10)
  
                  HStack {
                      Text(movie.title)
                          .font(.system(size: 20, weight: .semibold))
                      Spacer()
                      CircleView(firstColor: #colorLiteral(red: 0.2196078449, green: 0.007843137719, blue: 0.8549019694, alpha: 1), secondColor: #colorLiteral(red: 0.8078431487, green: 0.02745098062, blue: 0.3333333433, alpha: 1), width: 30, height: 30, percent: 4.6)
                  }
                  .padding(.horizontal)
                  .background(Color(UIColor.secondarySystemBackground))
                  .cornerRadius(10)
                  .shadow(color: Color.black.opacity(0.3), radius: 5, x: 0, y: 5)
                  .padding()
  
              Text(movie.overview)
                      .padding()
                      .background(Color(UIColor.secondarySystemBackground))
                      .cornerRadius(20)
                      .padding(.horizontal)
                      .shadow(color: Color.black.opacity(0.3), radius: 10, x: 0, y: 10)
              }
          }
          .animation(.easeIn)
          .offset(y: show ? UIScreen.main.bounds.height : .zero)
          .onReceive(trailer.$url) { (_) in
  
          }
      }
  }
  </code></pre>