Draw a loop over the grid lines.
Each eye sees in which of the four Cartesian directions the loop is closest to it (it may be closest in multiple directions, and it may not see the loop at all in some directions). Each of the closest directions has an arrow pointing to it.
A black arrow means that this direction is certainly one of the closest, while a white arrow means that this direction could be one of the closest, or could not be (there doesn't need to be a line at all in a white direction).
Note: a direction with no arrow is certainly not one of the closest.
There's a line directly below the square in the bottom left corner because there's a black arrow pointing in that direction, so we know the loop has to run in that direction. There's thus also a line directly right of this square as there is another black arrow pointing in that direction.
The loop continues form the bottom left corner upwards 2 segments and then turns right as there is no arrow pointing to the left of the first square in the second row. As the loop is directly next to the square the loop makes a U-turn around it because of the 2 black arrows.
The loop continues through the top left corner, over the second square in the first row and continues to the top right corner as there are no arrows pointing to lines going down. Then it runs in a U-turn around the top right square.
Now if you look from the third square in the bottom row, the loop can't run directly left of it, so the closest distance is 1. this means the minimal distance above it is 2 as there is no arrow pointing in that direction. So the loop continues left and then down.
The line has to be a minimal distance of 1 from the last square in the third row now, so the loop continues down and left and the puzzle is solved.