I'm creating an app where a user will be swimming using the HKWorkoutSession where the activity type is declared at init. However, what if the user leaves the water and starts running. Is there a way to detect this transition?
You cannot detect water on the watch. A swimming stroke involves the motion of the palm downwards. That motion is a constant rotation of the watch along the Y (I think it's Y) axis. This is true for crawl, back, butterfly and breast strokes (but not kickboard).The same is not true of running. Detecting that motion is a reasonable surrogate for 'the person is swimming'.