The invention discloses a swing type generating device and a buoy, and provides a generating device with a novel structure. The swing type generating device comprises a fixing plate, a spherical cover, a universal joint, a swing hammer, a swing frame, permanent magnets and magnetic induction loops, wherein the spherical cover comprises a mounting part and a spherical part, N groups of magnetic induction loops are uniformly arranged on the inner wall of the spherical part, N represents an even number, and each group includes multiple magnetic induction loops which are distributed along the vertical direction; the rotating center of the universal joint is located at the spherical center of the spherical part, and the swing hammer penetrates through a gap in the lower end of the spherical part, so that a heavy hammer on the swing hammer is located at the lower part; and the swing frame comprises a sleeve and brackets, an arc-shaped plate is fixed at the outer end of each bracket, the circle centers of the arc-shaped plates and the circle center of the spherical part are arranged, and multiple permanent magnets are uniformly arranged on the outer surface of each arc-shaped plate. According to the swing type generating device, waves in ocean can be fully utilized for generating power.