Niedawno przekonwertowałem kod na Swift 3.0. Metody źródła danych widoku zbioru i widoku tabeli zawierają teraz IndexPath
zamiast NSIndexPath
w sygnaturze metody. Ale wciąż wewnątrz definicji metody jest to typ odlewania IndexPath do NSIndexPath. tjNSIndexPath i IndexPath w Swift 3.0
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
{
let cell : NNAmenitiesOrFurnishingCollectionViewCell = self.amenitiesOrFurnishingCollectionView.dequeueReusableCell(withReuseIdentifier: "NNAmenitiesOrFurnishingCollectionViewCell", for: indexPath) as! NNAmenitiesOrFurnishingCollectionViewCell
cell.facilityImageName = self.facilityArray[(indexPath as NSIndexPath).row].imageName
cell.facilityLabelString = self.facilityArray[(indexPath as NSIndexPath).row].labelText
return cell
}
Czy ktoś może mi powiedzieć, dlaczego indexPath
jest typu lanego do NSIndexPath
.