如果xcode与iOS 11匹配,我如何告诉它包含特定的代码块?

如果xcode与iOS 11匹配,我如何告诉它包含特定的代码块?,ios,swift,xcode,Ios,Swift,Xcode,我只想在iOS 11上显示此代码。如果用户在iOS 10上,我不想以任何方式实现此委托 func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { if sections[section].items.count == 0{ return CGFloat.leastNormalMagnitude } return table

我只想在iOS 11上显示此代码。如果用户在iOS 10上,我不想以任何方式实现此委托

func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
    if sections[section].items.count ==  0{
        return CGFloat.leastNormalMagnitude
    }
    return tableView.sectionHeaderHeight
}
if #available(iOS 11.0, *) {
    // set delegate here
} else {
    // do nothing
}