15
최근에 Swift 3.0으로 코드를 변환했습니다. 내 컬렉션보기 및 테이블보기 데이터 소스 메서드의 메서드 서명에 NSIndexPath
대신 IndexPath
이 포함됩니다. 그러나 여전히 메서드 정의 안에는 IndexPath를 NSIndexPath로 캐스팅하는 형식이 있습니다. indexPath
이 NSIndexPath
에 주조 유형 이유 즉Swift 3.0의 NSIndexPath 및 IndexPath
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
}
사람은 말해 줄 수.