When I am connecting the device then i can detect, that cable is connected, but when cable unplug that time how will notify that cable is unpluged.
if (UIDevice.current.batteryState == UIDeviceBatteryState.charging)
{} else { } while unpluged method didn't call help me.