title: Should we use NSClassFromString before using any class in our code?
body: <p>I always wonder, should we use NSClassFromString before using any built in class in our code to make is generic. Or is there any standard practice to use this. Same thing for property. Should we use valueForKey and setValue calls separately to access any property. Is it a standard practice?</p>
  
  <p>For example look at the below code</p>
  
  <pre><code>// Screen scaling
    if ([self respondsToSelector:@selector(setContentsScale:)])
    {
     Class screenClass = NSClassFromString(@"UIScreen");
     if ( screenClass != Nil)
     {
      id scale = [[screenClass mainScreen] valueForKey:@"scale"];
      [(id)self setValue:scale forKey:@"contentsScale"];
     }
    }
  </code></pre>
  
  <p>Here everything is checked before use. Is it required to do this and what about performance?</p>