I was fetching Cellular Signal Strength(iOS < 11) as mentioned below, but in iOS 11 , signalStrength is always 0
let statusBarView = UIApplication.shared.value(forKey: "statusBar") as? UIView
if let foregroundView = statusBarView?.value(forKey: "foregroundView") as? UIView {
let subiews = foregroundView.subviews
var dataNetworkItemView:UIView?
for subview in subiews {
if subview.isKind(of: NSClassFromString("UIStatusBarSignalStrengthItemView")!) == true {
dataNetworkItemView = subview
break
}
}
var signalStrength = 0
var signalStrengthBars = 0
if let view = dataNetworkItemView {
signalStrength = view.value(forKey: "signalStrengthRaw") as! Int
signalStrengthBars = view.value(forKey: "signalStrengthBars") as! Int
}