How tools like crashlytics work? How they get crash log?

I want understand how tools like crashlytics works?

Like, they get crash log stack trace just fell minutes before throw and system crash?
They access some kind of crash dump that is generated after crash arrived?
In Object-C we had main. to maybe attach some code at run time, but in swift how they handle with?