Typically the Apocalyptic fiction in Science fiction is when humanity comes to an end. This can be achieved by self inflicted causes such as a nuclear war or by some sort of external force like aliens or a pandemic. The character who go through this event are forced to face extreme challenges before such an event or after.
Important works: A prominent example of an Apocalyptic fiction is Nevil Shute' "On The Beach". This novel takes place in Australia and New Zealand, where the last survivors of a worldwide nuclear war are located. Eventually the global winds carry the radiation towards the southern hemisphere and nearly everyone is has radiation poisoning. The Australian government then offers the citizens or refugees suicide pills to end their suffering. The story goes into the moral and psychology implications of assisted suicide as well as emphasize the impact and dire consequences that could be had if the world were to really go into a nuclear war with each other. This novel has been very well received and had even been called "emotional wallop. It should be made mandatory reading for all professional diplomats and politicians" by Galaxy Science Fiction magazine.