이 경고는 내가 염려해야 할 사항입니까? 'Int'로 'NSNumber'브리징 경고
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let destination = segue.destination as? ProfileViewController{
let cell = sender as! UITableViewCell
let selectedRow = myTableView.indexPath(for: cell)!.row
switch (mySegmentedControl.selectedSegmentIndex){
case 0:
destination.nameVar = userSFList[selectedRow].name!
destination.imageOneURL = userSFList[selectedRow].image!
destination.bioVar = userSFList[selectedRow].bio!
if let image2 = userSFList[selectedRow].imageTwo {
destination.imageTwoUrl = image2 }
if let contactInt = userSFList[selectedRow].contact as? Int {
destination.contact = contactInt
}
break
case 1:
destination.nameVar = userEBList[selectedRow].name!
destination.imageOneURL = userEBList[selectedRow].image!
destination.imageTwoUrl = userEBList[selectedRow].imageTwo!
if let contactInt = userEBList[selectedRow].contact as? Int {
destination.contact = contactInt
}
break
case 2:
destination.nameVar = userSFOList[selectedRow].name!
destination.imageOneURL = userSFOList[selectedRow].image!
if let contactInt = userSFOList[selectedRow].contact as? Int {
destination.contact = contactInt
}
break
case 3:
destination.nameVar = userSJList[selectedRow].name!
destination.imageOneURL = userSJList[selectedRow].image!
if let contactInt = userSJList[selectedRow].contact as? Int {
destination.contact = contactInt
}
break
default:
break
}
}
}
I 4 개 가지 부분으로 분할 된 제어를 사용 중포 기지를 사용하여 데이터를 인상하고있다.
다음과 같이하십시오.'destination.contact = userEBList [selectedRow] .contact.intV alue'; 옵션이 아니라면'destination.contact = userEBList [selectedRow] .contact.intValue ??와 같은 것을 할 필요가있을 것입니다. 0 '(즉, 디폴트는 0)이다. –
동일한 코드가 3 번 반복되는 이유는 무엇입니까? – Alexander
@Alexander 그것은 userEBList, userSJList 및 userSFOList의 세 가지 경우처럼 보입니다. –