Re: Sharing NIB/XIB between different apps?
Re: Sharing NIB/XIB between different apps?
- Subject: Re: Sharing NIB/XIB between different apps?
- From: Steve Mills via Cocoa-dev <email@hidden>
- Date: Fri, 6 Mar 2020 09:19:09 -0600
> On Mar 6, 2020, at 09:04, Gabriel Zachmann via Cocoa-dev
> <email@hidden> wrote:
>
> Is it possible to share one NIB/XIB between two different apps?
> If yes, what would be the best approach for development: different Xcode
> projects, or different targets within the same Xcode project?
Sure. The easiest way is to have both products in the same project, but
different targets, of course. The targets can share anything in the project.
The harder way is to put all the common code and resources into a framework,
then add the framework to each project. I use the first method in my
screensaver and desktop image randomizer to share the UI as a self-contained
view controller.
> .Dummy question on the side:
> so far, the screensaver framework opens the options sheet for me when the
> user clicks "Screen saver options".
> How would I open it "manually" in my standalone app?
The same way you load and show any window. You could add a custom view to your
app’s window, then load the shared view controller from its nib and add it to
the custom view. Look for Apple examples/docs for loading nibs, using view
controllers, etc.
Steve via iPhone
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden