title: Can I view the implementation of the appendFormat instance method in Objective-C?
body: <p>I'd like to see how <code>appendFormat</code> is implemented in Objective-C:</p>
  
  <p><a href="https://developer.apple.com/reference/foundation/nsmutablestring/1497308-appendformat" rel="nofollow noreferrer">https://developer.apple.com/reference/foundation/nsmutablestring/1497308-appendformat</a></p>
  
  <pre class="lang-objc prettyprint-override"><code>- (void)appendFormat:(NSString *)format, ...;
  </code></pre>
  
  <p>Is there a way to see the implementation?</p>
  
  <p>I found this:</p>
  
  <p><a href="https://github.com/cjwl/cocotron/blob/master/Foundation/NSString/NSMutableString.m#L111" rel="nofollow noreferrer">https://github.com/cjwl/cocotron/blob/master/Foundation/NSString/NSMutableString.m#L111</a></p>
  
  <pre class="lang-objc prettyprint-override"><code>-(void)appendFormat:(NSString *)format,... {
     NSString *string;
     NSRange   range={[self length],0};
     va_list   arguments;
  
     va_start(arguments,format);
  
     string=NSAutorelease(NSStringNewWithFormat(format,nil,arguments,NULL));
     va_end(arguments);
  
     [self replaceCharactersInRange:range withString:string];
  }
  </code></pre>
  
  <p>But I'm not sure if it's the same as for Cocoa.</p>
  
  <p>I want to see the implementation so I can confirm the runtime. Since <code>appendFormat</code> is for mutable strings, I'm assuming <code>appendFormat</code>'s runtime is worst case O(n) and amortized O(1), but I'm not sure.</p>
  
  <p>(I'm not an Objective-C Developer.)</p>