Somehow combine with search controller not working, any idea?

后端 未结 1 770
轻奢々
轻奢々 2021-01-23 01:16

For some reason when I type in the search field it does not print out Xcode console the \"str\". What am I missing here? I followed his tutorial https://www.letsbuildthatapp.com

相关标签:
1条回答
  • 2021-01-23 02:00

    You are creating a Sink object with the .sink method, but you are not storing it anywhere. Therefore it goes out of existence immediately and there is no pipeline to publish to.

    The correct procedure here is to have an instance property typed as Set<AnyCancellable> and call store(in:) on your sink to store it in that instance property. Now it will persist and there will be something to print out.

    0 讨论(0)
提交回复
热议问题