For WWAN, you can get this state via CTCellularData in the Core Telephony framework.
For Wi-Fi (which is only access controlled on iPhones built for China), there’s no equivalent public API. I encourage you to file an enhancement request for that. Please post your bug number, just for the record.
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"