I always recommend any of the villages with ferry service (https://www.travelmar.it/en/index) OR Atrani, which is just a short walk from Amalfi. Amalfi/Atrani are good bases for hiking because some trails originate in Amalfi and you can just set off without taking a bus or taxi to a trailhead. But there are trails all over the peninsula, so you have many choices. There are two books that describe the trails, one published by Cicerone and the other by Sunflower. They give transport info so can be really helpful for planning. Ferries are seasonal, so be sure to add what month (I assume summer since you mentioned swimming).
From NAP, you can take a bus direct to Salerno and switch to ferry there (or bus). https://www.aeroportodinapoli.it/en/by-bus
We chose to stay in Cetara for the restaurants and lack of crowds, but the bonus was our room was a bargain. The only caveat is that this b&b is a walk uphill from Cetara, but if you are going to the area to hike I suspect you would also be fine with this. We had no problem walking down to Cetara and back for dinners, and we visited Pompeii from this base as well. Owner was lovely and we had a sea view: https://www.ilglicinebb.it/en/homepage/
Don't worry about relying on ferry and bus--that is the way to do this area (along with hiking shoes!). Try to use ferry as much as possible because the buses can be full. You could probably do it with one base, but I like the idea of two--maybe one more convenient for moving around and another where you are really off the grid.