A man who slapped a woman on the bottom twice didn't realise he had committed a crime but did now, Derry Magistrate's Court has heard.