Maximize iPhone battery lifespan by keeping it plugged into power whenever possible

Yes - keep your iPhone XS and newer plugged in unless you put it in long term storage. Then 50% charge and power it off.

There is no reason to not fully charge and keep attached the latest iPhone and iPad devices that run iOS 11.3 since there are now charge management enhancements to avoid voltage pressure and lack of discharge that can cause issue on older devices and operating systems.

  • https://support.apple.com/en-us/HT208710

iOS includes a charge management feature to maintain battery health when iPad or iPhone XS, iPhone XS Max, or iPhone XR is connected to power for prolonged periods of time, such as when used in a kiosk or a point of sales system, or stored in a charge cart.

Your XS is better off to leave plugged in since that reduces charge cycles. Unless you aren't going to use if for a couple months, then discharge or charge to 50% and shut it off:

  • https://www.apple.com/batteries/maximizing-performance/

Older devices and older operating systems do require you to balance the need to have it charged with the need to delay eventual failure. Every single lithium battery will eventually swell and/or disconnect itself electrically if it doesn't fail some other manner prematurely.

  • https://support.apple.com/en-us/HT208387 - information on chemical aging of batteries

  • iPad being using in wall mount battery swollen


I know, sometimes it can explode

To ensure this to a very high degree (no pun intended) that this doesn't happen, always make sure to use official or certified cables and accessories to charge your iOS device.

While it is true that Lithium-ion batteries age with the number of charge cycles depleted (which as I understand you are trying to cut down on), there are other factors as well that affect battery health, such as extreme temperatures and storage considerations. From the Apple Support document, iPhone Battery and Performance:

A normal battery is designed to retain up to 80% of its original capacity at 500 complete charge cycles when operating under normal conditions.

Additionally, there are other relevant documents from Apple that includes tips on how you can maximize the lifespan of your iPhone's battery.

  • Charge and monitor the iPhone battery

  • Maximizing Battery Life and Lifespan

In general, you can leave your iPhone plugged into power and use it, unless the device doesn't heat up, exceeding the recommended temperature range. This could happen due to use of an unofficial/uncertified accessory, presence of a case or using an app which taxes the hardware thereby causing device heat-up.

Avoid charging or leaving the iPhone in hot environments, including direct sun exposure, for extended periods of time.

Apple also recommends to keep your iPhone updated to the latest available public version of iOS for your iPhone as Apple software updates often include advanced energy-saving technologies.