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