title: check for updates on Firebase Storage and replace the old content?
body: <p>what i wanna do is every time i open the app or there is new data changed from the server the data saved locally should be updated.</p>
  
  <p>i have used this code to download and save the data locally </p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
  
  
      if book?.bookPath !=  book?.bookPath {
          print("HERE \(book?.bookPath)")
          loadReader(filePaht: (book?.bookPath)!)
  
      } else {
  
          let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
          let strName = book?.id
          let filePath = "\(documentsPath)/"+strName!+".pdf"
          let fileManager = FileManager.default
  
          if fileManager.fileExists(atPath: filePath) {
              loadReader(filePaht: filePath)
              return;
          }           
          let reference = FIRStorage.storage().reference(forURL: (self.book?.bookURL)!)
           downloadTask =  reference.data(withMaxSize: 50 * 1024 * 1024) { (data, error) -&gt; Void in
              if (error != nil) {
  
              } else {
  
                  if ((try! data?.write(to: URL.init(fileURLWithPath: filePath, isDirectory: false))) != nil) {
                      self.db.upDate(id: (self.book?.id)!, bookPath: filePath)
  
                      self.loadReader(filePaht: filePath)
                  }
              }
          }
          downloadTask.observe(.resume) { (snapshot) -&gt; Void in
              // Download resumed, also fires when the download starts
          }
  
          downloadTask.observe(.pause) { (snapshot) -&gt; Void in
              // Download paused
  
          }
          downloadTask.observe(.progress) { (snapshot) -&gt; Void in
  
              }
  
  
          downloadTask.observe(.success) { (snapshot) -&gt; Void in
  
          }
  
          downloadTask.observe(.failure) { (snapshot) -&gt; Void in
  
          }
  
      }
  }
  
      }
  }
  </code></pre>
  
  <p>what happens here is the data gets downloaded locally on the phone and when i change it on firebase it doesn't change on the phone itself after being downloaded </p>