I recently stumbled upon something strange in my code, I have been programming in one project for several days, but suddenly I tried to create a lazy property using this code:
import UIKit class CategoryViewController: UICollectionViewController { lazy var searchController: UISearchController = { let searchController = UISearchController(searchResultsController: nil) searchController.searchBar.frame = CGRect(x: 0, y: 0, width: CGRectGetWidth(self.collectionView.frame), height: 44) return searchController }() }
Now every time I try to refer to myself using in a lazy block, it produces this:
self.(<#NSObject#>)
and cannot access any of the other properties.
If I try to hard code them, it produces:
UICollectionView? does not have a member named 'frame'
And the above code shows:
Extra argument 'width' in call
I already tried to rewrite the code and exclude derived data, build again, but the error persists. Any ideas as to why this could happen?
Thanks in advance
Update autocomplete field:

source share