How can I distribute my objective c library with source code embedded - objective-c

I would like for people to be able to debug my library, should they feel like they want to.
For this I think a good idea would be to embed the source in the library / framework itself. Does Xcode support this option?
For reference of what I’m looking for, in Java you can build a Jar file which comes with the attached source code (and optional javadoc) embedded within the library https://stackoverflow.com/a/5064833/48062

Xcode does not support this option, no. Your best bet would be to upload the source to Github (https://github.com) and include the link in your documentation for the framework. That way you can be sure that your users can always get to the freshest, most up to date, code.

Related

Kotlin/Native Basic Image manipulation

Does Kotlin/Native support any image-processing libraries?
(I'm targeting Windows & Linux)
I failed to find anything on google that doesn't target JVM/Android, but I am new to the Kotlin ecosystem so the answer might be right under my nose.
I'm looking for basic manipulations:
open/save image(jpg, png)
resize
extract crop
If there aren't any, should I try to create bindings for C Image processing library like stb-image or opencv?
There is a korim library, that might help you. Also, there are several places you can find more info on Kotlin/Native libraries, like here and here. The option with C library seems also like a good idea. If you'll got some problems with it, feel free to ask here on in Kotlin Slack (get an invite here).

Is there a good way in XCode to reuse Classes across projects and easily share with other devs?

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.

Generate Objective-C code from any other language

Are there frameworks/generators for producing iOS code from any other language?
A dynamic language like JavaScript, ruby or Python are preferred. Googling for iOS code generators was largely fruitless.
The problem with systems like PhoneGap is that their output is a full-fledged application. What I need to produce is a library (.a & .h file eventually) that other Objective-C developers can reuse in their projects.
RubyMotion may or may not do what you want. I haven't seen much about the practicalities of it yet, but I'm thinking since it's statically compiled chances are good that it can produce libraries that can be simply linked into Objective-C projects. One might need another tool to produce the header files.
Of course, this is all speculation.
I think the best solution for what you're looking for is Titanium. It has its own sdk (in JavaScript), a complete IDE and allows you to have one codebase for all major platforms (iOS, Android included). What it's really awesome is the fact that it actually generates native code (a valid XCode project or a Java one for Android). It's also free and open source. Definetely worth a look.
I've never seen code generators, but there are a variety of "spoofs" as it were.
http://xamarin.com/monotouch - iOS on C#
http://phonegap.com/ - iOS on HTML, CSS , Javascript
http://ipodtoucher55.blogspot.com/2010/06/how-to-create-iphone-apps-in-flash-cs5.html - one of several tutorials for flash on iOS
I've seen links to python libraries and I think java too.
When it comes down to it though, they're all work arounds, not direct development.

How to parse Objective-C code within a Cocoa application

I am writing a Mac OS X desktop application in which I want to be able to parse fragments of Objective-C such as variable and method declarations, as well as full Objective-C header and source files.
It looks to me as if I should be making use of Clang to do this, but I could do with some pointers and examples on how to integrate it as a library in my project, and how to invoke it to parse strings and files.
Can anyone provide me with any help on this?
You probably want libclang, code browsable at http://llvm.org/svn/llvm-project/cfe/trunk/tools/libclang/ (though you'll need to checkout the entire Clang repo to build it). There's very little documentation around on it, sadly. There is a presentation at http://llvm.org/devmtg/2010-11/Gregor-libclang.pdf that might help kickstart things, but mostly just some hunting through the code is the way to go.
Clang is actually more modular than libclang provides for (you can import just the components you want). If you've adventurous, there are examples at http://llvm.org/svn/llvm-project/cfe/trunk/examples/.

How to compress a file without using any external libraries?

I need to be able to compress file in an iPhone/iPad application. I know there are a few libraries out there that have this problem solved and are easy to integrate in an application, but I was wondering if there is something already implemented in Cocoa. It would help me a lot if I did not need to integrate external libraries in my project.
Do you mean something in iOS / objective-c ? If so, you do know that most objects you are using is an 'external library' i.e. the Foundation framework?
There is, shipped with every iPhone, libz which is the library for zipping / unzipping. You just include it as if it were any other framework.
However, the chances that you will, first time, use it as bug free as an existing library that's been tested for years by hundreds of other developers is slim.
Personally, I would easily choose adding a library over writing my own for something like this - it's been done before, you're just wasting time re-writing it. Try ZipArchive for a one-liner to unzip files etc. Just copy the source code into your app and press build :)
I don't think there is something like that in cocoa inbuild .. but you should have a look here - https://bitbucket.org/kolpanic/zipkit/wiki/Home