Add target to iOS/macOS Multi-Platform Project (Xcode 12) - xcode

Xcode 12 (Beta) introduced the new multi-platform project template for iOS/macOS apps. If I add a new target (File -> New -> Target... -> Watch App), Xcode adds a new app project to the existing one.
My preference is, that the watchOS-Project uses the shared folder, like the iOS and macOS app.
My question is, how to integrate another app project, like watchOS or tvOS, to an existing multi-platform project? As a reference, I found a GitHub-Project, which integrated watchOS and tvOS in a multi-platform project: https://github.com/jordansinger/SwiftUI-Kit

I also struggled adding an new target for an additional platform. I ended up doing it like this:
Create new project for iOS platform and name it "iOS"
Rename project (first file in the file list) to your product name. Xcode will ask you if you want to rename all other project files -> click on "Don't rename"
While the project file is still selected, you see a column with the targets. Click on the "+" on the bottom and select the app template for an other platform (e.g. tvOS). Set the product name to "tvOS" and click on "Finish".
Add more platforms if needed.
Go through all targets and change the Bundle Identifier for each of them to the correct product name.
Create the following folders by right-clicking on the project file and choosing "New Group": Shared, Shared Tests, Shared UITests.
Now you move the files you want to share between all platforms from one of the platform folders to the "Shared" folder (e.g. ContentView.swift). Delete all those files from the other platforms folders.
Go through all the files in the "Shared" folder and select the other platforms under "Target Membership":
9. Do the same for the Tests und UITests
It's cumbersome, but it works. Maybe somebody else finds a better way...

Related

How to prevent Xcode Archive from including my sub projects' Products?

I am trying to build an app with Xcode 10.2.1 and submit it to the Mac App Store.
However, when I archive it, the Organizer does not show my app's version, and the button on the right is titled "Distribute Content" and not "Distribute App" as it should. And I won't get to option to upload the to Store.
When I export to disk, I see that the archive contains a "Products" folder at the top level, and then multiple folders containing all my included sub projects, containing frameworks and helper tools.
As all these are already linked into the app, I don't need to have them also in the Archive as separate items, of course. And I suspect that's the reason why I can't submit the app from the Organizer.
If I make a regular build, the build/Release folder only contains the app, not the other products.
What could I be doing wrong, i.e. how to I prevent the products from the sub projects to be included in the main project's Archive?
I need to keep these other projects inside the main project so that I do not forget to build them when I change code in one of their source files.
Here's some information of how I set this up:
The main project shows the other projects in the left browser when I open its disclosure triangle.
The main project's target's Build Phases also lists these sub project's targets.
The Scheme, under Build, shows the main project's target, with the other targets are children. All checkboxes are ticked.
The Scheme, under Archive, selects the Release build config.
Work-around
For now, I build the app regularly, then use the cmdline tool as follows to create a pkg file that I then upload with Apple's Application Loader:
productbuild --component "MyApp.app" /Applications --sign "3rd Party Mac Developer Installer: My Name" "MyApp.pkg"
The fact that this works suggests that my app is fine. It's just the added products that are causing the trouble for the Organizer.
As suggested in this Tweet, the solution is to set "Skip Install" to YES in every sub project's Build Settings.

Appcelerator Studio new project alternatives

I am new to Appcelerator Studio and a bit confused over the different alternatives when starting a new project.
I started two projects, one with menu
"New - Mobile App Project - (Project Template) Default Project", and the second with
"New - Mobile App Project (Project Template) Single Window Application".
Both projects have, Titanium SDK version 5.2.0.GA, Deployment Targets: iPhone, Mobile Web, and Unchecked Enable Appcelerator Platform Services.
Please see image link below from Studio Project Explorer on how these two projects look like:
The first project (DefaultProject) makes a single window with two tabs. The second project (SingleWindowApplication) just makes a single window.
Why are the structure of these to projects/apps that different?
In the first, the window creation etc. are done in app.js.
In the second, the code has been moved around to directories like common, handheld and tablet.
What should be the right questions to ask (for an app making beginner) in order to choose between those two "template" projects?
In the second project, why do I get the android and tablet directories? I did specify targets iPhone and Mobile Web.
Why is directory i18n present in the second project but not in the first?
At first, if you start learning Ti, I would start with an Alloy project and straight learn this route. Helps you to be more organized in your projects (MVC structure).
The projects you've created are classis Ti projects (works fine too). The different folders are just a way to organize your projects. You can create them in the first example if you like to. E.g. the i18n is just not part of the first template but if you start to create a multilanguage project you would just add it.
The targets you define are used during compiling. So if you compile it for iphone it won't add the android assets in there, so just ignore those folders (the template creates them). If you create a empty project from the command line ti create select app and android it will just create the android folder in the Resources directory. But if you run alloy new to create an Alloy project inside this directory it will automatically create all other asset folders (again, ignore them, they won't be used)

How to install FLTK project template in Xcode 6?

I downloaded FLTK 1.3.2 and the instructions for xcode 4 say that is enough to copy the FLTK folder (inside ide/Xcode4/Project Templates) into /Developer/Library/Xcode/Project/Templates/Other. So I did, but it seems like things have changed from xcode 4 to xcode 6: now all project templates have a directory that ends with .xctemplate, and inside the folder there is a single .plist file. Instead the FLTK folder has another hierarchy:
Indeed it doesn't work: the project template doesn't appear on the list when I select "new project" in Xcode.
I have not used FLTK, but I can tell you that Xcode custom project templates should go in the following location:
/Users/Username/Library/Developer/Xcode/Templates/Project Templates/GroupName
Where Username is your OS X username and GroupName is the group name on the left side of the New Project Assistant. You can create your own group name or use one of the built-in names, such as Other. You may need to manually create some of the directories in the path.

Xcode auto include header for sibiling project

i have a workspace in xcode with two project (sibiling, not parent->child) a project is a static library, and other project is a standard app.
Now i need to drag headers file from library project to app project but this a bit annoying, how i need to configure 'header search path' parameter?
thanks
I add other details: now the path is:
$(SRCROOT)/../Build/Products/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/include/UtilityLibrary
i create a Build folder and from xcode preferences i configured this folder to receive all builed prioject.

Xcode: Dragging a Project to a Workspace shows tiny .xcodeproj file in Project Navigator. What's wrong?

Setup:
Xcode 4.3.1 (or 5.x)
OS X 10.7.3
I have reproduced this issue on two separate late-model Macs with this setup.
Steps:
Create a new Mac "Cocoa Application" Xcode Project. File > New > Project… Name it "MyApp".
Create a new Workspace: File > New > Workspace… Name it "MySuite".
Drag MyApp.xcodeproj file from the Finder into the Project Navigator of "MySuite" Workspace.
Expected:
The Project Navigator of the "MySuite" Workspace should now show a full sub-Project for "MyApp" with Source, Targets, etc.
Actual:
"MySuite" Workspace Project Navigator shows a tiny MyApp.xcodeproj item in the Project Navigator. (see screenshots)
Dragging:
Result:
What am I doing wrong in trying to add a Project to a Workspace?
Be sure you don't have the project already open in another window. Xcode only lets you open a project one time. I've made this mistake a lot when working on a framework then trying to add it to an application.
Simply close the project you're trying to drag in's window and everything will be happy.

Resources