Fish excel in their swimming capabilities. These result from a dynamic interplay of actuation, passive properties of fish body, and interaction with the surrounding fluid. In particular, fish are able to exploit wakes that are generated by objects in flowing water. A powerful demonstration that this is largely due to passive body properties are studies on dead trout. Inspired by that, we developed a multi-joint swimming platform that explores the potential of a passive dynamic mechanism. The platform has one actuated joint only, followed by three passive joints whose stiffness can be changed online, individually, and can be set to an almost arbitrary nonlinear stiffness profile. In a set of experiments, using online optimization, we investigated how the platform can discover optimal stiffness distribution along its body in response to different frequency and amplitude of actuation. We show that a heterogeneous stiffness distribution - each joint having a different value - outperforms a homogeneous one in producing thrust. Furthermore, different gaits emerged in different settings of the actuated joint. This work illustrates the potential of online adaption of passive body properties, leading to optimized swimming, especially in an unsteady environment.