I have made a framework in Xcode. Each time I want to add it to another project, I need to look for it in its folder. Is there a way to add it to the frameworks list (like all the Apple frameworks) so that it's easier to add to a project?
Thanks.
Related
I have a library that I created which I would like to use the included classes across a few different projects while maintaining the library code independently. I would also like to be able to easily share it with other developers and have them easily implement it. At this point it doesn't need to be a static library.
What is the best method to do this? I have seen other devs put their classes in a brand new XCode project then import that, but what is best practice?
I think the best practice is to create a project with a static library target. Other developers can include it as a subproject in their projects.
Second best would be to simply make a directory of source files that can be included in a project on an as-needed basis. This is useful for general purpose utility code where a particular project may not want all of it.
In both cases, the library code should belong to its own git repository and included in a project as a git submodule.
If it will ever become a static library, it's best to make it one now, rather than waiting until it is "ready"; by the time you decide to switch it over, a few projects will already be using it, and converting each of them to use it will be a pain. Just do it the right way from the beginning.
If you want to distribute the library without source, you will want to use lipo to build a universal library that contains both ARM and x86 code. Unfortunately, Xcode doesn't make this as easy as it could be, but it's not too difficult with some light shell scripting.
As far as I know you should create a new project and that project to any other project you want use library in. Then link the projects and you can access it. The other way which I have done also, copy the library classes directly to the new project and access the library through importing the needed classes. In my case i found creating a project and linking it with the new project is the easiest. although copying the classes isnwhat we all do when using external libraries such as cocos2d. As far as sharing it with others, just upload it to github another place of your choice so it can be used by other dev's. I hope this helps you.t
I don't know how mature the code is, but since you specifically mention wanting to share it with other developers, you may want to investigate CocoaPods.
I have two projects which share quite a portion of logic, localizations, properties and even views (Logindialog, Popovers etc.). I now want to put the intersecting set into a new project, which should be used as some sort of common library.
I want to keep the common project as a git submodule in my other projects:
Project A
- Classes
- Resources
- CommonLibrary (git submodule)
Project B
- Classes
- Resources
- SomeBSpecificFolder
- CommonLibrary (git submodule)
The CommonLibrary would now probably also be it's own Xcode project. I am not sure now how I should tackle this problem. I know of the following options:
Use a library (.a-file and .h file)
TestFlight e.g. does it like this. I quite like the fact that I can just compile against a binary and don't "see" the source. So just a clean API for doing things.
Include the whole project (Project dependency)
Three20 does it like this and I find it quite annoying to have some 6 subprojects in my project. However in my case it would only be one project, so this might be an option too.
Just have loose source files without a project inside the CommonLibrary folder and manually add them to both of the projects. The project would then compile the sources along with any project-specific sources. This looks a big like a workaround to me and I guess I would prefer to somehow bundle the common sources. Also if there are new files, I always have to add them to the other projects.
Can you guys give me some advice and tell me if there is another option or what you think are the advantages and disadvantages about these approaches?
Thanks a lot for your help!
From a clean, non-application specific perspective, you should be looking to create a library/ framework. This provides:
the reusability you want
without extending build time of dependent projects,
while maintaining consistency of the code base (maintainability),
keeping your API consistent across using projects and
managing dependencies between layers
In terms of Xcode, if I remember correctly from my OpenStep days, you should be looking to create a new Framework project which will provide the relevant makefiles for that type of project. A cursory surf produced:
http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html
and the slightly more friendly:
http://atastypixel.com/blog/creating-applications-in-xcode-using-frameworks/
Furthermore, you might actually want to layer your frameworks to further improve reusability. That is, don't just create one framework, create one per tier: put common code in a Foundation framework, UI/ AppKit-based classes in a UI framework, etc. This way, your frameworks are relevant to whatever tier your using classes and projects live.
For instance, if you have a category on some foundation class, put it in a common/ foundation framework that can be reused by any other common/ foundation classes and projects you build. If you were to put it in a UI-tier framework with UI libraries and dependencies then it couldn't be reused by your foundation level projects (as these can't have UI-level dependencies).
Hope this helps...
I found a project called RestKit on github which seems to be a good example for a third-party framework, which can be included in an existing project.
The readme and the wiki describe nicely which steps need to be done in order to include the project. I guess this is a good starting point for someone who want to create a framework himself.
I'm not a javascript/css/html programmer. If anything I'm an objective-C, C#, C++, java programmer.
Looking at Dashcode there are features of the Utility project, Stacklayout project and some custom views that I'd like to combine into one webapp. This app would use 2 layers of stacklayout navigation, and use the infobutton to flip one of the views to get to the settings.
Is there a good way to combine dashcode projects? I notice the the generated "parts.js" file only contains dashcodePartSpecs for elements that Apple has included in that project. Can dashcode be used for non-trival projects? or this there a better way. (and yes I've already created an app store app, but Apple is trying to steal our subscription money.)
Cheers,
Gerry
There are similar to Dashcode tools that generate web "apps" Phonegap, iui, jqtouch, extjs and others.
They are essentially html/js/css frameworks from third parties. Dashcode does not get much attention from Apple where as both Phonegap and Extjs are actively supported. There is also an O-Reilly book covering Phonegap.
How do I create a reusable library/module in XCode 3.2? What I want to do is create a bunch of classes that provide certain functionality compile them into some kind of library, add such a library to an existing xcode project and use the classes in it.
I come from .NET world so what I want to do is basically to create an equivalent of 'assembly' and then reference it somehow in my XCode project.
I am developing for iOS btw.
If you add a target called static library you will get the equivalent of an assembly, just put all the sources in the target and decide what headers should be published and what should be hidden to the user of your library.
What you are looking to do is create a 'framework'.
This page has some useful information.
http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPFrameworks/Frameworks.html
I am new to Xcode (and Objective C in general) and I want to create a new Objective-C Library (Framework?) which will be used by some of our iPhone applications in the future.
Which type of project should I choose when Xcode shows the new project dialog? I tried selecting "Blank Project" but then I faced some issues in defining the target, dependencies, etc.
I want my project to be easily re-usable in the future both in code form and as a .dylib.
I would appreciate some help with this. Links to online docs are welcome.
Since version 3 of the SDK you are able to create library projects in Xcode. However, those projects do not create .dylib libraries, but static .a libraries.
You cannot create Frameworks for iOS, as Apple's own App Store rules state that apps sold through the App Store cannot load code dynamically, which is what Frameworks are for. Libraries are designed to be statically linked.