It's been talked about for a while now and Apple is finally doing it. If you try to replace your iPhone XS, XS Max or XR battery with a non-official Apple battery or even an original battery at a third-party repair center, the you will get an error message.
The message says that the iPhone can't verify if the battery is original or not so it won't give you information about the battery's health. This means that you can still use your phone and the battery's functionality won't be limited in any way but you won't be able to see when it's due for a replacement.
The guys over at The Art of Repair tried to swap two genuine iPhone's batteries and they got the same message. There's a microcontroller on the battery itself to push information to the iPhone and Apple uses a proprietary version of the chip, which in turn authenticates the battery and pairs it with the logic board. This can be done only at an official service repair center.
A fool and his money are soon parted.