You can do it that way. Switching viewpoints by chapters is common because it works and the reader doesn’t get confused about which character’s head he/she is in.
You can do it other ways, if you wish. And if you are able to keep the reader clear as to whose head you’re in at the moment.
I’ve read scenes where the viewpoint switches every sentence or so and it worked because the author did it well.
So it all depends on you as a writer.