title: Complex line warns: AnyObject is not a subtype of NSObject
body: <p>I'm trying to convert the following code into Swift 3. Its purpose is to print the cellular signal strength to the console. The StackOverflow post this came from can be found <a href="https://stackoverflow.com/a/34389611/1500134">here</a>.</p>
  <pre><code>UIApplication *app = [UIApplication sharedApplication];
  NSArray *subviews = [[[app valueForKey:@&quot;statusBar&quot;]     valueForKey:@&quot;foregroundView&quot;] subviews];
  NSString *dataNetworkItemView = nil;
  for (id subview in subviews) {
      if([subview isKindOfClass:[NSClassFromString(@&quot;UIStatusBarSignalStrengthItemView&quot;) class]])
      {
          dataNetworkItemView = subview;
          break;
      }
  }
  int signalStrength = [[dataNetworkItemView valueForKey:@&quot;signalStrengthRaw&quot;] intValue];
  NSLog(@&quot;signal %d&quot;, signalStrength);
  </code></pre>
  <p>And, after my own attempts (swift is new to me), some online converters, and Xcode's automatic conversion from Swift 2.2 to 3, i'm stuck with two issues. Here is the current problematic code:</p>
  <pre><code>let app = UIApplication.shared
  let subviews: NSArray = (((app.value(forKey: &quot;statusBar&quot;))! as AnyObject).value(forKey: &quot;foregroundView&quot;))!.subviews
  var dataNetworkItemView: NSString?
  for subview in subviews {
      if (subview as AnyObject).isKind(of: NSClassFromString(&quot;UIStatusBarSignalStrengthItemView&quot;)!) {
          dataNetworkItemView = subview as? String as NSString?
          break
      }
  }
  let signalStrength = Int(((dataNetworkItemView!.value(forKey: &quot;signalStrengthRaw&quot;) as! String) as NSString ?? &quot;0&quot;).intValue)
  print(&quot;signal \(signalStrength)&quot;)
  </code></pre>
  <p>The second line (let subviews: ...) throws the error:</p>
  <p><code>'(AnyObject)' is not a subtype of 'NSObject'</code></p>
  <p>and the second to last line (let signalStrength = ...) throws the following warning:</p>
  <p><code>Left side of nil coalescing operator '??' has non-optional type 'NSString' so the right side is never used</code></p>
  <p>The second issue makes more sense to me than the first, but how can I go about fixing the actual error? I'm not intending to be spoon-fed code but rather am trying to figure out why the error exists and what would satisfy the error and produce the desired results. Thanks :)</p>