I recently stumbled onto something weird in my code, I have programming in the same project for a few days but all of a sudden I tried to create a lazy property with 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 reference self from with in the lazy block it produces this:
self.(<#NSObject#>)
and can't access none of the other properties.
If i try to hard-code them it produces:
UICollectionView? does not have a member named 'frame'
And the code above displays:
Extra argument 'width' in call
I already tried to rewrite the code and eliminating the derived data, build again but the error keeps persisting. Any ideas as to why it could happen?
Thanks in advance
Update autocomplete box: