Unfortunately, iPhone has no such feature that allows you to know if someone is tracking your device. We strongly advise that you should not use any public wifi or internet connection to prevent your device from getting tracked. The hackers try to access your device using the public network connection. Whenever you connect to it, they get access to your device remotely. Any third-party application which is not privately protected can also lead to the disclosure of your personal information.