The invention provides a swash plate type axial piston pump or a motor, which comprises a shell, a main shaft, a plurality of piston components, a swash plate, a cylinder, a distributive flow disk and a connecting part, wherein the connecting part comprises a first part and a second part which relatively swing, the first part is combined with the main shaft and synchronously rotates with the main shat, the swash plate is combined with the second part and synchronously rotates with the second part, a cylindrical inner hole is arranged on the center of the cylinder, the main shaft stretches into the cylindrical inner hole, the main shaft and the cylindrical inner hole are matched, and when the main shat rotates, the cylinder is driven by the piston components to rotate. The main shaft and the cylinder of the swash plate type axial piston pump can form clearance fit, the transmission line of the swash plate type axial piston pump is the main shaft, the connecting part, the swash plate, the piston components and the cylinder, and the swash plate type axial piston pump has the advantages of excellent assembly, high total efficiency and small lateral force, and can achieve the advantages of coaxial or through-shaft connection and the like.