Reputation: 1442
I want to embed a App A in another App B. When App A is launched it should act as a wrapper and internally launch App B without showing App B in docbar.Purpose of App A is just a wrapper ,it should do some initialisation to launch App B depending from where it is getting launched
Upvotes: 0
Views: 513
Reputation: 3439
In your project, build both apps using separate targets.
In App A > Target > Build Phases:
Target Dependancies
Copy Bundle Resources
phase.Now when you build App A, Xcode will build App B and copy the finished App B into the Resources
folder of App A's bundle.
You don't explain why you want to do this, so here are some ideas to get you started...
Option A:
Use the NSBundle
class to locate the embedded App B and launch it however you see fit (directly, using launchd
, etc.).
If you don't want App B to show up in the dock or have a menu bar, you need to set the LSUIPresentationMode
in the app's Info.plist
or adjust the app's activationPolicy
property programatically.
Option B:
Consider creating an XPC Service. An XPC services is a special embedded executable that macOS will launch for you whenever you need it and set up an XPC connection for you so you can talk to it and do work.
XPC also has facilities so that a faceless (non-app) helper process can have a UI that appears in your app. (This is the way Safari works; each page is handled by a separate helper process, using XPC to control the page and present it in a Safari window.)
Upvotes: 4