challange + attributedText:
override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let activityIndicatorView = UIActivityIndicatorView(activityIndicatorStyle: .whiteLarge)
activityIndicatorView.color = .darkGray
activityIndicatorView.startAnimating()
activityIndicatorView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(activityIndicatorView)
NSLayoutConstraint.activate([
activityIndicatorView.topAnchor.constraint(equalTo: tableView.bottomAnchor, constant: 20),
activityIndicatorView.centerXAnchor.constraint(equalTo: tableView.centerXAnchor)
])
let label = UILabel()
let attributedText = NSMutableAttributedString(string: "Loading ", attributes: [NSAttributedStringKey.foregroundColor: UIColor.darkGray, NSAttributedStringKey.font: UIFont.systemFont(ofSize: 14)])
attributedText.append(NSAttributedString(string: "Podcast episode", attributes: [NSAttributedStringKey.foregroundColor: UIColor.purple, NSAttributedStringKey.font: UIFont.boldSystemFont(ofSize: 14)]))
label.attributedText = attributedText
label.textAlignment = .center
label.translatesAutoresizingMaskIntoConstraints = false
activityIndicatorView.addSubview(label)
NSLayoutConstraint.activate([
label.topAnchor.constraint(equalTo: activityIndicatorView.bottomAnchor, constant: 6),
label.heightAnchor.constraint(equalToConstant: 30),
label.widthAnchor.constraint(equalToConstant: 200),
label.centerXAnchor.constraint(equalTo: activityIndicatorView.centerXAnchor)
])
return activityIndicatorView
}