如何在RxSwift中实现RxJava文本更改
我想在swift 3中用RxSwift实现自动完成文本字段 我用java编写了这段代码,效果很好,但我不知道如何用RxSwift实现swift 3。 我在rxSwift中搜索了TextChange,但什么也找不到 这是我的密码如何在RxSwift中实现RxJava文本更改,swift,swift3,uitextfield,rx-swift,Swift,Swift3,Uitextfield,Rx Swift,我想在swift 3中用RxSwift实现自动完成文本字段 我用java编写了这段代码,效果很好,但我不知道如何用RxSwift实现swift 3。 我在rxSwift中搜索了TextChange,但什么也找不到 这是我的密码 RxTextView.textChanges(mEtAddress) .map(CharSequence::toString) .debounce(100, TimeUnit.MILLISECONDS)
RxTextView.textChanges(mEtAddress)
.map(CharSequence::toString)
.debounce(100, TimeUnit.MILLISECONDS)
.filter(s -> !TextUtils.isEmpty(s))
.compose(bindUntilEvent(FragmentEvent.STOP))
.flatMap(q -> mReactiveLocationProvider.getPlaceAutocompletePredictions(
q, new LatLngBounds(
new LatLng(SOUTHWEST_LATITUDE, SOUTHWEST_LONGITUDE),
new LatLng(NORTHEAST_LATITUDE, NORTHEAST_LONGITUDE)), null))
.subscribe(buffer -> {
List<AutocompleteInfo> infos = new ArrayList<>();
for (AutocompletePrediction prediction : buffer) {
infos.add(new AutocompleteInfo(prediction.getFullText(null).toString(), prediction.getPlaceId()));
}
buffer.release();
mPlaceSuggestionsList.setAdapter(new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1, infos));
});
rxtview.textChanges(元地址)
.map(CharSequence::toString)
.debounce(100,时间单位毫秒)
.filter->!TextUtils.isEmpty(s))
.compose(bindUntilEvent(FragmentEvent.STOP))
.flatMap(q->mReactiveLocationProvider.getPlaceAutocompletePredictions(
q、 新LatLngBounds(
新纬度(西南纬度、西南经度),
新纬度(东北纬度,东北经度),空)
.订阅(缓冲区->{
List infos=new ArrayList();
用于(自动完成预测:缓冲区){
add(新的AutocompleteInfo(prediction.getFullText(null.toString(),prediction.getPlaceId());
}
buffer.release();
setAdapter(新的ArrayAdapter(getActivity(),android.R.layout.simple_list_item_1,infos));
});
您需要RxCocoa
对UIKit
进行反应式扩展。
UITextified已扩展,并具有属性rx
。
您可以使用被动文本属性:
textField.rx.text...