XCode 15 warnings

I am puzzled by a deluge of warnings like "This code path does I/O on the main thread underneath that can lead to UI responsiveness issues. Consider ways to optimize this code path" on code that sems perfectly inocuous, like

`class FileOrFolderCell: UICollectionViewCell {

//...

let emojiLabelInitialFontSize: CGFloat = 64. //<--- flagged as a potential hang pont (wha!!?)

//...

var isNew = false { //<--- potential hang point

didSet { newBadge.isHidden = !isNew } }

//....

}`

Can anybody offer insights on how to address this? Thanks.

Replies

For sure, Xcode may be very verbose and some warnings are hard to solve (even impossible).

But you can silence the warnings and just keep errors.

  • In the Issues navigator
  • click on x at the bottom on the Filter line

Could you show the real and more complete code, so that we can understand these "hang pont" (???) messages

I am sorry, I meant hang point, not "pont" . As far as more complete code goes, I don' t see much point, since it happens at initailization of a CGFloat instance variable, but here you go, code for the entire class:

class FileOrFolderCell: UICollectionViewCell, CustomCell {
    @IBOutlet weak var emojiLabel: UILabel!
    @IBOutlet weak var nameLabel: MarqueeLabel!
    @IBOutlet weak var emojiBadge: UILabel!
    @IBOutlet weak var imageView: UIImageView!
    
    let emojiLabelInitialFontSize: CGFloat = 64

    @IBOutlet weak var newBadge: UILabel!
    var url: URL!
    var thumbURL: URL?

    var isNew = false {
        didSet {
            newBadge.isHidden = !isNew
        }
    }
    
    var emoji = "" {
        didSet {
            emojiLabel.text = emoji
            emojiBadge.text = emoji
        }
    }
    func setFontSizesFor(width: CGFloat) {
        emojiLabel.font = emojiLabel.font?.withSize(32)
        newBadge.font = newBadge.font?.withSize(20)
    }
    
}

As you see, there is basically nothing there and whatever little this is, it all has to run on the UI thread (it is a subclass of UICollectionView).