Ich benutze CustomCollectionViewLayout von https://github.com/brightec/CustomCollectionViewLayout.Konvertierung Swift2 -> Swift3: Fehler mit Any
Nach der Konvertierung von Swift2 nach Swift3 treten zwei Fehler bezüglich Any auf.
Error1:
override func layoutAttributesForItem(at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? {
return self.itemAttributes[indexPath.section][indexPath.row] as! UICollectionViewLayoutAttributes
}
Nachricht Fehler:
CustomCollectionViewLayout.swift:115:54: Type 'Any' has no subscript members
Fehler 2:
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
var attributes = [UICollectionViewLayoutAttributes]()
if self.itemAttributes != nil {
for section in self.itemAttributes {
let filteredArray = (section as AnyObject).filtered(
using: NSPredicate(block: { (evaluatedObject, bindings) -> Bool in
return rect.intersects(evaluatedObject.frame)
})
) as! [UICollectionViewLayoutAttributes]
attributes.append(contentsOf: filteredArray)
}
}
return attributes
}
Fehlermeldung:
Value of type 'Any?' has no member 'frame'
Haben Sie Ideen, wie Sie die Probleme mit Any/AnyObject beheben können?
ich auch gleiche Frage, die sich am –