The open source plugin for productivity metrics, goals, leaderboards, and automatic time tracking.
Download WakaTime for Mac.
Move WakaTime.app into your Applications folder, and run WakaTime.app.
If prompted, enter your API Key then click Save.
Use Xcode like normal and your coding activity will be displayed on your WakaTime Dashboard.