re-purpose LaunchScreen.storyboard?

This is for XCode 10.2.1 and future editions.


I would like to create a customized LaunchScreen that I can reuse in all of my apps.


I used Interface Builder to create my custom LaunchScreen in one app.


Then, I tried to copy-paste the XML "LaunchScreen.storyboard" source from this app to another app but got a "Build Failed".

With some tweaking perhaps, Is this (XML re-use) possible? If so, any gotcha's with this approach?


Thanks!

Accepted Reply

>a "Build Failed".


Any related error(s)? Builds fail for any number of reasons, so...


Have you consider one project with multiple targets, that all share a common LS.sb?


Another option is to create a base project, using it as a template for others. Duplicate the original project folder, tweak paths accordingly, and make sure each project app is unique where it needs to be in Xcode's mind.


Also, just for grins, create a new project, wiping it's LS.sb, then option-clean, then try a select-drag/drop of the desired LS.sb into the new one with both project open at the same time.


As for XML copy/paste, keep in mind that the file in Xcode relies on specific line endings/wraps/returns, so that can be one gotcha, at least - be -very- careful when throwing that XML around manually.


As noted, I'd try an option-clean build folder...hold the option key, then use the Product menu, selecting to 'clean build folder'.

Replies

Did you do a clean Build Folder ?


ANother point: did you copy the file from Finder ?

You'd better copy the content of XML file into the ccreated launchStoryboard XML of the new app.


Do you copy as well the various launchscreen.strings files (idem, copy contents, not directly the files)?


There may be a risk of conflict for the Objects ID that you import with other objects in your code.


Is your launch storyboard so complex that you need to copy and paste instead of recreate ?

I'm not sure that would be a very useful function for other people…

>a "Build Failed".


Any related error(s)? Builds fail for any number of reasons, so...


Have you consider one project with multiple targets, that all share a common LS.sb?


Another option is to create a base project, using it as a template for others. Duplicate the original project folder, tweak paths accordingly, and make sure each project app is unique where it needs to be in Xcode's mind.


Also, just for grins, create a new project, wiping it's LS.sb, then option-clean, then try a select-drag/drop of the desired LS.sb into the new one with both project open at the same time.


As for XML copy/paste, keep in mind that the file in Xcode relies on specific line endings/wraps/returns, so that can be one gotcha, at least - be -very- careful when throwing that XML around manually.


As noted, I'd try an option-clean build folder...hold the option key, then use the Product menu, selecting to 'clean build folder'.

Thanks for the reply @Claude31. I have two instances of Xcode open and am copy-pasting from one launchScreen's XML to the other - just taking a shotgun approach as I am not familiar with the details at this point.


I want to create a common launchScreen among many apps for branding purposes.

It would be nice to have a method of re-use for this purpose.


My take away from your answer is that this is possible, which is nice to know. I just need to figure out the details now.