I am developing a Swift Package that also includes a code generator. Is there a way to test the generated code using XCT? The important part is that tests use the generated code.
I thought I could add a test target and only build it after the code generation step. I can't find a way to add a build step to Swift package, though. Is this possible?
Another "solution" that I've considered is creating a workspace that references a project with generated code and the package itself. Then, I would create two targets and add a code generation build step to the test project. The problem with this idea is that we don't get test coverage and I am not sure how to add Swift Package to a workspace. Is there any tutorial on this?
Thank you for your help!
Related
I want to build a custom framework in pure swift. Then I want to export that custom framework and import it into another pure swift app project. I want to do this by linking to the framework in the "Link binary with libraries" build phase. Seems straightforward but I never get it working in this particular approach.
I have googled for solutions and tried out some things. However I don't want objective-c interoperability. It's all pure swift anyway. Also I don't want to create an app project and then add embed a framework in to that (what is the point of this anyway?). Neither do I want to reference the framework project (by dragging the framework project into the app project). And I certainly don't want to create a workspace. All the solutions I found fall into one of these categories.
Every framework and every app I work on should be contained to its own little project universe.
Thus far I am stuck at the errors "no such module" and "linker command failed with exit code 1". A link with step by step instructions would be appreciated or any other advice you might have pertaining to this issue.
The examples are not working for me, why?
It tells me loadDocSet.scpt => Shell Script Invocation Error.
I have build an own example in my project and it works, but I can't open the examples.
The Linking and everything else for the configuration of core plot is done well.
Googled that problem but didn't find a solution till now.
It sounds like you're trying to build the documentation set instead of the proper application or framework target. In Xcode, make sure your build scheme is set to CPTTestApp-iPhone or whatever the example application is that you need to build, and not Documentation.
Based on the latest version in the Mercurial repository, the sample applications compile just fine for me when the scheme is set as I describe above.
I am looking for a simple library ( and/or app - eventually want both ) example ( like a math library or whatever) for iOS which has a makefile for it that I can use as a template to make other makefiles from and learn. Static of course, (and dynamic if iOS supports it so I can have 2+ apps that share common code)
There is lots of incomplete and cryptic info out there but so far I havn't found any nice concise "with these source files" you create a makefile this way to build an iOS "fat" library I can import into other projects.
This would be on a Mac with the ios4 sdk installed.
It is always great to start with something that basically works.
I have created complex makefiles before for unix and windows and for other devices.
thanks.
The first link pictorially represents the process step by step that you've asked then the second link contains a package that allows a programmer to compile a make file based project
click me
click me
If you want to build a static library using a make file and link against it every time you build your Xcode project, you can add a "run script" build phase in your project before all the others, which runs this make file, and then add the built library to your linking phase. If you want a make file that builds the entire iOS project, I don't think it's posible (you can use the command line to compile the project without Xcode opened though).
How do I reference another project which has code I wish to leverage in XCode 4. In particular I'm trying to make use of the NSDate extensions from here.
Some notes:
I was assuming I should probably reference rather than trying build a framework
I tried copying the existing "Hello World" xcode project file across into my project, however this didn't seem to work
Do I need to create a new "Target" based on "coco touch static library" option?
Then would I need to Edit the current Product Scheme so that when I build the new target would build
What do I need to do on my project side exactly - should going Add Files, and choosing the extensions Xcode Project File be enough?
thanks
I was assuming I should probably reference rather than trying build a framework
yes, reference and link with it, unless you need only a bit of it. at this stage, separating the bits you want may be an advanced topic (depends on the lib's layout/depends as well). you should prefer to reference and link because it will normally minimize your maintenance time, especially if you use it in multiple projects.
I tried copying the existing "Hello World" xcode project file across into my project, however this didn't seem to work
you don't create a project, you add the library's xcode project to your app or library, set the lib as a dependency, add the library to your search paths if needed, then link with the library.
Do I need to create a new "Target" based on "coco touch static library" option?
no
Then would I need to Edit the current Product Scheme so that when I build the new target would build
no. you configure it as a dependency. you may need to alter the lib's build settings if there is a major conflict, which the linker or compiler would point out.
What do I need to do on my project side exactly - should going Add Files, and choosing the extensions Xcode Project File be enough?
start with the process outlined above.
There is no reason to bring in an actually project. Either you can bring in the source files themselves and you could even use the same exact files instead of copying them if you want. However, if you have more than just a few files, and you don't think you will be changing the code much, then creating a static library would probably be the best option.
When reusing code (for example, a Util library you created), do you add its project to your solution or use a compiled/published DLL from the Util library?
If an assembly is mature, not likely to change or I'm fairly certain I won't need to step into it I would reference the DLL. If it's likely that changes will be made in the assembly's project or it's likely I'll want to step into it, I reference the project.
I add the project if I want to be sure to have all changes and the latest version of the library. Then I can update the library project when I am updating my whole solution.
If I want to be certain that I am using a specific version of the library, I'll just add the dll.
Edit: Also, what Mitch said.