Maintain 2 Versions for same APP

Hello all, I have two versions of the same app (SwiftUI) , one of which is free (ad-supported) and the other is not.

My two current XCode projects has identical code, but the free one has AdMob code inside.

The code in my current two projects in XCode is same, however the free one includes AdMob.

I don't like this method because I have to copy and paste changes I make to one into the other.

Is it possible to generate a version for the Apple Store with only one project and omit some code?

Or I'll have to proceed as I am currently, using the same code for two projects.

Thanks a lot!

Maintain 2 Versions for same APP
 
 
Q