Swift Combine: append() operator

Do you know prepend() operator? prepend() operator allows you to add additional elements before the sequence. But append() operator is adding new elements at the end of the operator.

append()

Let’s take an example. I created numbers range from 1 to 10 and made it a publisher.

You can see that you can either pass variadic parameter or an array and appended values appear at the end of the array,

Passing in publisher

In this example, I passed in publisher2 and you can check the result. It’s successfully added.

Conclusion

  • append() operator adds elements at the end of the array.
  • append() operator takes in variadic , array and publisher as an argument.

--

--

Software Engineer, Mobile Developer living in Seoul. I hate people using difficult words. Why not using simple words? Keep It Simple Stupid!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
KD Knowledge Diet

Software Engineer, Mobile Developer living in Seoul. I hate people using difficult words. Why not using simple words? Keep It Simple Stupid!