Include an extension for a class only if iOS11 is available

前端 未结 3 919
暗喜
暗喜 2020-12-31 17:24

I am trying to extend a class written in Obj-C and include an extension written in Swift that makes it conform to the UIDropInteractionDelegate, like so:

<
3条回答
  •  暖寄归人
    2020-12-31 17:51

    In ObjC, adding API_AVAILABLE(ios(11.0)) to end of the function definition will suppress the warning. Like this:

    - (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView leadingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0))
    {
         ... function implementation ...
    }
    

提交回复
热议问题