-1

Hi We have an application that contains two modules (user and admin), Both share some common code related to a few features. As per requirement, we need to create two apps (user and admin), How can we share the code efficiently between two projects?

Thanks in advance.

KAREEM MAHAMMED
  • 1,675
  • 14
  • 38
  • 1
    There are more than one options here. Either you share the modules (via SPM for example) in completely separate projects or (simpler) you have two targets (one for each app) in the same project. – Alladinian Dec 08 '22 at 07:58
  • Thanks for your reply @Alladinian Will you please share any sample regarding two targets in same project. – KAREEM MAHAMMED Dec 08 '22 at 08:01
  • [Here you go](https://developer.apple.com/documentation/xcode/configuring-a-new-target-in-your-project) (If we are talking about existing Xcode projects then they must be grouped inside a workspace) – Alladinian Dec 08 '22 at 08:04

1 Answers1

0

You have basically three ways if you're working on an iOS app :

  1. Apple's way: Frameworks.
  2. Making a CocoaPod. This is really convenient if you want to share the module, and can be easily integrated in XCode.
  3. Swift's way: Swift Package. In my opinion this slightly less convenient but is completely platform-agnostic, so you can reuse your code even on other platforms.
Big Bro
  • 797
  • 3
  • 12