How to set RxTimeInterval for debounce in RxSwift?

Change this line:

.debounce(0.5, scheduler: MainScheduler.instance)

To this line:

.debounce(RxTimeInterval.milliseconds(500), scheduler: MainScheduler.instance)

searchBar
    .rx.text // Observable property thanks to RxCocoa
    .orEmpty // Make it non-optional
    .debounce(.milliseconds(500), scheduler: MainScheduler.instance) // Wait 0.5 for changes.
    .distinctUntilChanged() // If they didn't occur, check if the new value is the same as old.
    .filter { !$0.isEmpty }