Chapter 8 " Add a last-modified header to the request"

After the new Relay created:

“private let lastModified = BehaviorRelay<String?>(value: nil)”

, then accept() was called two times:

“if let lastModifiedString = try? String(contentsOf: modifiedFileURL, encoding: .utf8) {
 lastModified.accept(lastModifiedString)

}

and

“.subscribe(onNext: { [weak self] modifiedHeader in
  guard let self = self else { return }

  self.lastModified.accept(modifiedHeader)
  try? modifiedHeader.write(to: self.modifiedFileURL, atomically: true, encoding: .utf8)
 })
 .disposed(by: bag)

My question is: This behaviorRelay lastModified was never subscribed, so how the accept() will work?

Thanks,
Mike

@mike Do you still have issues with this?

Thanks for asking. I am ok with this now.

This topic was automatically closed after 166 days. New replies are no longer allowed.