Search code examples
iosswiftcombinedeployment-target

Do I still need the @available 13.0 attribute in my class if my minimum deployment target is iOS 13.0?


I am adding Combine to my iOS application. To do this, I have updated my create account ViewModel to use Combine rather than my previous implementation. Upon adding Combine to my ViewModel, I was met with an error prompting me to add @available(iOS 13.0, *) to my class. I also must add this attribute to every single VC that uses this ViewModel. My deployment target is iOS 13.0 so I am wondering if this is really necessary. Is there a way I can avoid adding this attribute in each class since I will have no users operating on an iOS version lower than iOS 13.0?


Solution

  • No. You only need to use @available annotation when your deployment target is lower than the minimum OS version required for the API you are using.

    So when targeting iOS 13, you don't need @available for Combine.