Value of type 'UITableView' has no member 'sectionHeaderTopPadding'
Why I am getting build error from Xcode 12.4 (simulator ios 14.x) for the following code?
if #available(iOS 15.0, *) {
myTableView.sectionHeaderTopPadding = 0.0 // error here
}
The error was,
Value of type 'UITableView' has no member 'sectionHeaderTopPadding'
If ios 15 is not available Xcode is supposed to skip compiling this code. Isnt it?
Because xCode 12.x supports max iOS 14.x development, so how can your xCode know what is provided in iOS 15.x
If you are working with a team member and your teammate have xCode 13.x then either you can update your xCode to use the this code, or you can comment this code and then build from your xCode (12.x).
You can make a condition for compilation
#if compiler(>=5.5)
if #available(iOS 15.0, *) {
myTableView.sectionHeaderTopPadding = 0.0
}
#endif
Update your XCODE version to 13