searchBar.rx.textDidBeginEditing does not working when im trying to edit text











up vote
-3
down vote

favorite
1












    searchBar.rx.textDidBeginEditing
.subscribe { [unowned self] in
print("im begining diting")
self.searchBar.setShowsCancelButton(true, animated: true)
}
.disposed(by: disposeBag)


It does not working, maybe I have wrong method? but I have method



    searchBar.rx.text
.asObservable()
.bind(to: directoryViewModel.searchTextObservable)
.disposed(by: disposeBag)


Its working properly










share|improve this question






















  • You haven't shown enough code to reproduce the problem. If I put those two blocks of code in a viewDidLoad, they work exactly as expected.
    – Daniel T.
    Nov 17 at 20:37










  • what should I show? cause the second block works fine, but the first one doesn't want to call.
    – Serj Semenov
    Nov 17 at 23:25










  • Are you getting any runtime warnings from the console? Have you assigned a delegate to the searchBar? You show a minimum compilable example that exhibits the problem. Write a small project the the least code possible that still has the problem you are seeing.
    – Daniel T.
    Nov 17 at 23:26












  • I don't get no runtime warnings and no I didn't assigned to delegate. I wrote a small project but the same problem, probably I just don't know how to use this
    – Serj Semenov
    Nov 18 at 0:02










  • I'd love to see the project. Maybe I can figure out what's going on.
    – Daniel T.
    Nov 18 at 0:06















up vote
-3
down vote

favorite
1












    searchBar.rx.textDidBeginEditing
.subscribe { [unowned self] in
print("im begining diting")
self.searchBar.setShowsCancelButton(true, animated: true)
}
.disposed(by: disposeBag)


It does not working, maybe I have wrong method? but I have method



    searchBar.rx.text
.asObservable()
.bind(to: directoryViewModel.searchTextObservable)
.disposed(by: disposeBag)


Its working properly










share|improve this question






















  • You haven't shown enough code to reproduce the problem. If I put those two blocks of code in a viewDidLoad, they work exactly as expected.
    – Daniel T.
    Nov 17 at 20:37










  • what should I show? cause the second block works fine, but the first one doesn't want to call.
    – Serj Semenov
    Nov 17 at 23:25










  • Are you getting any runtime warnings from the console? Have you assigned a delegate to the searchBar? You show a minimum compilable example that exhibits the problem. Write a small project the the least code possible that still has the problem you are seeing.
    – Daniel T.
    Nov 17 at 23:26












  • I don't get no runtime warnings and no I didn't assigned to delegate. I wrote a small project but the same problem, probably I just don't know how to use this
    – Serj Semenov
    Nov 18 at 0:02










  • I'd love to see the project. Maybe I can figure out what's going on.
    – Daniel T.
    Nov 18 at 0:06













up vote
-3
down vote

favorite
1









up vote
-3
down vote

favorite
1






1





    searchBar.rx.textDidBeginEditing
.subscribe { [unowned self] in
print("im begining diting")
self.searchBar.setShowsCancelButton(true, animated: true)
}
.disposed(by: disposeBag)


It does not working, maybe I have wrong method? but I have method



    searchBar.rx.text
.asObservable()
.bind(to: directoryViewModel.searchTextObservable)
.disposed(by: disposeBag)


Its working properly










share|improve this question













    searchBar.rx.textDidBeginEditing
.subscribe { [unowned self] in
print("im begining diting")
self.searchBar.setShowsCancelButton(true, animated: true)
}
.disposed(by: disposeBag)


It does not working, maybe I have wrong method? but I have method



    searchBar.rx.text
.asObservable()
.bind(to: directoryViewModel.searchTextObservable)
.disposed(by: disposeBag)


Its working properly







ios swift rx-swift rx-cocoa






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 17 at 15:13









Serj Semenov

236




236












  • You haven't shown enough code to reproduce the problem. If I put those two blocks of code in a viewDidLoad, they work exactly as expected.
    – Daniel T.
    Nov 17 at 20:37










  • what should I show? cause the second block works fine, but the first one doesn't want to call.
    – Serj Semenov
    Nov 17 at 23:25










  • Are you getting any runtime warnings from the console? Have you assigned a delegate to the searchBar? You show a minimum compilable example that exhibits the problem. Write a small project the the least code possible that still has the problem you are seeing.
    – Daniel T.
    Nov 17 at 23:26












  • I don't get no runtime warnings and no I didn't assigned to delegate. I wrote a small project but the same problem, probably I just don't know how to use this
    – Serj Semenov
    Nov 18 at 0:02










  • I'd love to see the project. Maybe I can figure out what's going on.
    – Daniel T.
    Nov 18 at 0:06


















  • You haven't shown enough code to reproduce the problem. If I put those two blocks of code in a viewDidLoad, they work exactly as expected.
    – Daniel T.
    Nov 17 at 20:37










  • what should I show? cause the second block works fine, but the first one doesn't want to call.
    – Serj Semenov
    Nov 17 at 23:25










  • Are you getting any runtime warnings from the console? Have you assigned a delegate to the searchBar? You show a minimum compilable example that exhibits the problem. Write a small project the the least code possible that still has the problem you are seeing.
    – Daniel T.
    Nov 17 at 23:26












  • I don't get no runtime warnings and no I didn't assigned to delegate. I wrote a small project but the same problem, probably I just don't know how to use this
    – Serj Semenov
    Nov 18 at 0:02










  • I'd love to see the project. Maybe I can figure out what's going on.
    – Daniel T.
    Nov 18 at 0:06
















You haven't shown enough code to reproduce the problem. If I put those two blocks of code in a viewDidLoad, they work exactly as expected.
– Daniel T.
Nov 17 at 20:37




You haven't shown enough code to reproduce the problem. If I put those two blocks of code in a viewDidLoad, they work exactly as expected.
– Daniel T.
Nov 17 at 20:37












what should I show? cause the second block works fine, but the first one doesn't want to call.
– Serj Semenov
Nov 17 at 23:25




what should I show? cause the second block works fine, but the first one doesn't want to call.
– Serj Semenov
Nov 17 at 23:25












Are you getting any runtime warnings from the console? Have you assigned a delegate to the searchBar? You show a minimum compilable example that exhibits the problem. Write a small project the the least code possible that still has the problem you are seeing.
– Daniel T.
Nov 17 at 23:26






Are you getting any runtime warnings from the console? Have you assigned a delegate to the searchBar? You show a minimum compilable example that exhibits the problem. Write a small project the the least code possible that still has the problem you are seeing.
– Daniel T.
Nov 17 at 23:26














I don't get no runtime warnings and no I didn't assigned to delegate. I wrote a small project but the same problem, probably I just don't know how to use this
– Serj Semenov
Nov 18 at 0:02




I don't get no runtime warnings and no I didn't assigned to delegate. I wrote a small project but the same problem, probably I just don't know how to use this
– Serj Semenov
Nov 18 at 0:02












I'd love to see the project. Maybe I can figure out what's going on.
– Daniel T.
Nov 18 at 0:06




I'd love to see the project. Maybe I can figure out what's going on.
– Daniel T.
Nov 18 at 0:06












1 Answer
1






active

oldest

votes

















up vote
-1
down vote



accepted










I forgot to put onNext:



searchBar.rx.textDidBeginEditing
.subscribe(onNext: { [unowned self] in

self.searchBar.setShowsCancelButton(true, animated: true)

}).disposed(by: disposeBag)





share|improve this answer























  • That's not the reason it was failing. There was something else wrong.
    – Daniel T.
    Nov 18 at 0:40










  • Why not? It works fine now, just set asObservable() and subscribe(onNext:)
    – Serj Semenov
    Nov 18 at 10:51










  • Because if asObservable() was necessary, then the code wouldn't have even compiled without it.
    – Daniel T.
    Nov 18 at 14:25











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53352519%2fsearchbar-rx-textdidbeginediting-does-not-working-when-im-trying-to-edit-text%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
-1
down vote



accepted










I forgot to put onNext:



searchBar.rx.textDidBeginEditing
.subscribe(onNext: { [unowned self] in

self.searchBar.setShowsCancelButton(true, animated: true)

}).disposed(by: disposeBag)





share|improve this answer























  • That's not the reason it was failing. There was something else wrong.
    – Daniel T.
    Nov 18 at 0:40










  • Why not? It works fine now, just set asObservable() and subscribe(onNext:)
    – Serj Semenov
    Nov 18 at 10:51










  • Because if asObservable() was necessary, then the code wouldn't have even compiled without it.
    – Daniel T.
    Nov 18 at 14:25















up vote
-1
down vote



accepted










I forgot to put onNext:



searchBar.rx.textDidBeginEditing
.subscribe(onNext: { [unowned self] in

self.searchBar.setShowsCancelButton(true, animated: true)

}).disposed(by: disposeBag)





share|improve this answer























  • That's not the reason it was failing. There was something else wrong.
    – Daniel T.
    Nov 18 at 0:40










  • Why not? It works fine now, just set asObservable() and subscribe(onNext:)
    – Serj Semenov
    Nov 18 at 10:51










  • Because if asObservable() was necessary, then the code wouldn't have even compiled without it.
    – Daniel T.
    Nov 18 at 14:25













up vote
-1
down vote



accepted







up vote
-1
down vote



accepted






I forgot to put onNext:



searchBar.rx.textDidBeginEditing
.subscribe(onNext: { [unowned self] in

self.searchBar.setShowsCancelButton(true, animated: true)

}).disposed(by: disposeBag)





share|improve this answer














I forgot to put onNext:



searchBar.rx.textDidBeginEditing
.subscribe(onNext: { [unowned self] in

self.searchBar.setShowsCancelButton(true, animated: true)

}).disposed(by: disposeBag)






share|improve this answer














share|improve this answer



share|improve this answer








edited yesterday

























answered Nov 18 at 0:16









Serj Semenov

236




236












  • That's not the reason it was failing. There was something else wrong.
    – Daniel T.
    Nov 18 at 0:40










  • Why not? It works fine now, just set asObservable() and subscribe(onNext:)
    – Serj Semenov
    Nov 18 at 10:51










  • Because if asObservable() was necessary, then the code wouldn't have even compiled without it.
    – Daniel T.
    Nov 18 at 14:25


















  • That's not the reason it was failing. There was something else wrong.
    – Daniel T.
    Nov 18 at 0:40










  • Why not? It works fine now, just set asObservable() and subscribe(onNext:)
    – Serj Semenov
    Nov 18 at 10:51










  • Because if asObservable() was necessary, then the code wouldn't have even compiled without it.
    – Daniel T.
    Nov 18 at 14:25
















That's not the reason it was failing. There was something else wrong.
– Daniel T.
Nov 18 at 0:40




That's not the reason it was failing. There was something else wrong.
– Daniel T.
Nov 18 at 0:40












Why not? It works fine now, just set asObservable() and subscribe(onNext:)
– Serj Semenov
Nov 18 at 10:51




Why not? It works fine now, just set asObservable() and subscribe(onNext:)
– Serj Semenov
Nov 18 at 10:51












Because if asObservable() was necessary, then the code wouldn't have even compiled without it.
– Daniel T.
Nov 18 at 14:25




Because if asObservable() was necessary, then the code wouldn't have even compiled without it.
– Daniel T.
Nov 18 at 14:25


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53352519%2fsearchbar-rx-textdidbeginediting-does-not-working-when-im-trying-to-edit-text%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

RAC Tourist Trophy