You can reference the character movement component using
GetCharacterMovement()
From there, you can either use the EMovementMode Enum, or the bool vars, the same way you would in BP’s.
void AMyCharacter::GetCharacterState()
{
// option 1: use the MovemenmtMode enum
if (GetCharacterMovement()->MovementMode == EMovementMode::MOVE_Swimming)
{
// is swimming
}
// option 2: reference the bool vars
if (GetCharacterMovement()->IsSwimming())
{
// player is swimming
}
}