Search code examples
xcodeswiftuiapple-appclips

#if APPCLIP doesn't recognise APPCLIP target


I created a new APPCLIP target and shared the same file between the main app and the app clip app but when I try to give add some specific code with #if APPCLIP that never get called, and I'm definitely running the AppClip target.

enter image description here


Solution

  • You have to add APPCLIP to your Active Compilation Conditions for the App Clip target:

    enter image description here