title: Style content in a TableView without causing the scrolling to lag
body: <p>I have a TableView, with about 15 to 20 displayed cells. The cell has a Label with the following class:</p>
  
  <pre><code>import Foundation
  import UIKit
  
  class RoundedLabel: UILabel {
  
      var inset: CGFloat = 16
  
      override func drawText(in rect: CGRect) {
          let insets = UIEdgeInsets(top: 2, left: 2, bottom: 2, right: 2)
          super.drawText(in: rect.inset(by: insets))
      }
  
      override func layoutSubviews() {
          super.layoutSubviews()
          updateCornerRadius()
      }
  
  
      override var intrinsicContentSize: CGSize {
          let size = super.intrinsicContentSize
          return CGSize(
              width: size.width + inset,
              height: size.height
          )
      }
  
      @IBInspectable var rounded: Bool = false {
          didSet {
              updateCornerRadius()
          }
      }
  
      func updateCornerRadius() {
          layer.cornerRadius = rounded ? frame.size.height / 2 : 0
          layer.masksToBounds = true
      }
  }
  </code></pre>
  
  <p>In my VC I have the following (I have to TableViews in one VC):</p>
  
  <pre><code>
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
      if tableView == tableViewMainLatest {
          let cell = tableViewMainLatest.dequeueReusableCell(withIdentifier: "cellMainLatest", for: indexPath) as! MainLatestTableViewCell
  
          let postDate = posts[indexPath.row].postDate ?? 0
          let formattedPostDate = Date(timeIntervalSince1970: postDate)
          let timeAgo = formattedPostDate.timeAgo(numericDates: false)
  
          let postCity = posts[indexPath.row].postFromCity ?? "?"
          let postCountry = posts[indexPath.row].postFromCountry ?? "?"
          let postComments = posts[indexPath.row].comments ?? 0
  
          let maxPostComments: String?
  
          // Only show the number if comment amount is less than 100
          if postComments &gt; 99 {
              maxPostComments = "99+"
          } else {
              maxPostComments = String(postComments)
          }
  
          cell.labelPostDate.text = timeAgo
          cell.labelPostFrom.text = postCity + ", " + postCountry
          cell.labelAmountComments.text = maxPostComments
  
          return cell
  
      } else if tableView == tableViewCategories {
          let cell = tableViewCategories.dequeueReusableCell(withIdentifier: "cellMainCategories", for: indexPath) as! MainApplicationCategoriesTableViewCell
          cell.labelCategories.text = pseudo[indexPath.row] as? String
  
          cell.alpha = 0.55
  
          UIView.animate(withDuration: 0.5, animations: {
              cell.alpha = 1
          })
  
          return cell
      }
  
      return UITableViewCell()
  
  }
  </code></pre>
  
  <p>My CustomCell:</p>
  
  <pre><code>class MainApplicationCategoriesTableViewCell: UITableViewCell {
  
      // Storyboard
      @IBOutlet weak var labelCategories: UILabel! {
          didSet {
              labelCategories.layer.borderWidth = 1
              labelCategories.layer.borderColor = UIColor(red:0.88, green:0.88, blue:0.88, alpha:1.0).cgColor
          }
      }
  
      override func awakeFromNib() {
          super.awakeFromNib()
          self.selectionStyle = .none
          // Initialization code
      }
  
      override func setSelected(_ selected: Bool, animated: Bool) {
          super.setSelected(selected, animated: animated)
          // Configure the view for the selected state
      }
  }
  
  </code></pre>
  
  <p>When I use this piece of code:</p>
  
  <pre><code>// Storyboard
  @IBOutlet weak var labelCategories: UILabel! {
      didSet {
          labelCategories.layer.borderWidth = 1
          labelCategories.layer.borderColor = UIColor(red:0.88, green:0.88, blue:0.88, alpha:1.0).cgColor
      }
  }
  </code></pre>
  
  <p>The scrolling of the TableView is lagging. Where do I have to apply the borderWidth / borderColor, to still have a good user experience without lagging?</p>