1

I want to use iOS 18's #Index in an app that still supports iOS 17.

This doesn't work:

@Model
final class MyModel {
    if #available(iOS 18, *) {
        #Index<MyModel>([\.prop1, \.prop2])
    }

    var prop1: Bool
    var prop2: Bool
}

How can I conditionally use that feature only on iOS 18?

1
  • 2
    It looks like this can't be done currently , I tried to use @available(iOS 18, *) but that clashed with the @Model macro and we can't move the #Index macro to an extension either unfortunately. Commented Aug 5, 2024 at 10:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.