title: How can I use CoreText to bold text?
body: <p>I am modifying a class that I found. It is underlining hyperlinks. I would like it to bold the hyperlink as well. I am not sure how to do this with CoreText.</p>
  
  <pre><code>-(NSMutableAttributedString*)attributedTextWithLinks {
      NSMutableAttributedString* str = [self.attributedText mutableCopy];
      if (!str) return nil;
  
      if (self.automaticallyDetectLinks) {
          NSError* error = nil;
          NSDataDetector* linkDetector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:&amp;error];
          [linkDetector enumerateMatchesInString:[str string] options:0 range:NSMakeRange(0,[[str string] length])
                                      usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop)
           {
               int32_t uStyle = self.underlineLinks ? kCTUnderlineStyleSingle : kCTUnderlineStyleNone;
               UIColor* thisLinkColor = (delegate &amp;&amp; [delegate respondsToSelector:@selector(colorForLink:underlineStyle:)])
               ? [delegate colorForLink:result underlineStyle:&amp;uStyle] : self.linkColor;
  
               if (thisLinkColor)
                   [str setTextColor:thisLinkColor range:[result range]];
               if (uStyle&gt;0)
                   [str setTextUnderlineStyle:uStyle range:[result range]];
           }];
      }
      [customLinks enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop)
       {
           NSTextCheckingResult* result = (NSTextCheckingResult*)obj;
  
           int32_t uStyle = self.underlineLinks ? kCTUnderlineStyleSingle : kCTUnderlineStyleNone;
           UIColor* thisLinkColor = (delegate &amp;&amp; [delegate respondsToSelector:@selector(colorForLink:underlineStyle:)])
           ? [delegate colorForLink:result underlineStyle:&amp;uStyle] : self.linkColor;
  
           if (thisLinkColor)
               [str setTextColor:thisLinkColor range:[result range]];
           if (uStyle&gt;0)
               [str setTextUnderlineStyle:uStyle range:[result range]];
       }];
      return [str autorelease];
  }
  </code></pre>