Housing starts in the US surged in June after a sharp drop a month earlier, driven by a rebound in apartment construction.