Objective-C @available guard AND'ed with more conditions

前端 未结 8 1308
眼角桃花
眼角桃花 2021-01-01 11:17

Objective-C has an @available expression in XCode 9+ / LLVM 5+ that allows you to guard a block of code to at least a certain OS version so that it won\'t emit unguarded ava

8条回答
  •  轮回少年
    2021-01-01 11:42

    inline bool iOS13()
    {
        if(@available(iOS 13, *))
            return true;
        else
            return false;
    }
    
    if(iOS13() && x == y)
        //...
    

提交回复
热议问题