Using Matlab capabilities in xcode project - ios

I am familiar with Matlab and would like to use what I know to add the functionality I am looking for in my iOS application. The title really says it all, I would like my app to be able to use the mathematics capabilities that matlab provides like integrals, derivatives, cross products, etc. not any graphing or any of that but just basic equation solving things. Is there a way to add this functionality to it while keeping my application agile. I have heard of the matlab coder that allow code to be switched from matlab to c or c++ that could be used for an Xcode project. If this is the best solution, is that a very difficult coder to work with? This is my first application, I have literally been working with Xcode and objective-c for a few weeks but I have the basic framework of my application good to go. I need this to add the real functionality to it and make it very useable. Please go easy on me if any of my questions seem obvious, I'm a nube, I really appreciate your answers.
Josh

As you mentioned, MATLAB Coder can generate C code from your MATLAB function. The header (.h) and source (.c) files can be plugged into your XCode project. The key part of the work is to decide what the input and output of the function should be and how to interface the rest of the XCode project with the Coder-generated function. Also, existing MATLAB code may not be completely compatible with the Coder, so that some modifications to your MATLAB code may be necessary. The Coder has interactive processes that guide you through this process.
If you haven't done so yet, you should start by looking at some examples of MATLAB Coder provided by MathWorks, e.g.,
http://www.mathworks.com/help/coder/examples/c-code-generation-for-a-matlab-kalman-filtering-algorithm.html?prodcode=ME&language=en

Related

Codename One (or ParparVM) how to compile Java library into iOS library

By checking the Codename One website and ParparVM Github, its guide only show how to build the Java (with Java Main function entry point) into the native executable/app (iOS), but I can't find any guide to build/compile Java into iOS share library (either in C source or binary, as long as can be reused by swift/objective-C from iOS app).
So are we able to do so? is there any guide for that?
It wasn't designed for that purpose so it probably won't work well for it. There are some inherent design decisions that would make it very difficult to get ParparVM to work with a library. Two big ones:
The GC needs to work with roots and would have a hard time collecting without full control of the app
The code generated looks "awful". Method names translate to very long function names in C with a very convoluted syntax to allow all sort of VM edge cases such as covariance
I suggest you look at J2ObjC. I haven't checked it out in ages but it was designed exactly with this use case in mind. It doesn't have a "real" GC but that might be OK with ARC. It works with your sources and produces libraries that look a bit more "natural" on iOS.

iOS PDF native search

I need to present and open pdf documents in my app. I would like to avoid third part libraries, because of update reasons (and I couldn´t find anyone created in swift).
I have been looking at QLPreviewController, UIDocumentInteractionController and presenting the pdf in an UIWebView. All these alternatives works fine for just presenting the pdf but I can´t find any built in search. I want functionality like the iBooks app.
Any advice is appreciated!
You'll likely wont find any 3rd-party frameworks written in Swift yet, simply because as of Swift 2.2 it's not binary compatible yet, and any binary framework written in Swift would be very fragile to break with even a minor update of Xcode (and updates to the compiler, that is).
I'm working on the commercial available PSPDFKit SDK for both iOS and Android. We're actually using a lot of C++ internally since raw performance is very important and Objective-C (and for many things, also Swift) are not yet fast enough for certain tasks.
We did invest a lot of time in adopting the latest Objective-C features such as nullability and generics next to declarations such as noescape for block-based API to make our SDK great to consume from within Swift.
While a separate Swift-wrapper could offer additional convenience, you'll find it very simple to use, and we're always working to adopt more features that improve bridging as they come available - there are a few interesting things in the Swift 3 proposals.
If you do not want to go the framework route, you can use CGPDFScanner to base a custom text extraction engine on. You will need to read up on Character Map Parsing - Page 446ff and many other sections - extracting text from a PDF document is surprisingly difficult, and after much work you'll be left with individual glyph positions and need to approximate where words are and if the document uses spaces or if you need to synthesize your own to correctly extract text. It's something that just takes a lot of experimentation and approximation to get right.

how do we display an image/color in lua

I am having this problem, and I am not able to figure out the solution.
I wish to display an image in some window if possible(not necessary tough), and then move it across the page by sending events from keyboard.
The problem is I can't use LÖVE framework, as we can't integrate it into our setup.
So I would require the Lua api's to do so.
Is anyone here aware about it? Also do I have to install some kind of extra library to support color and image operations?
Thanks for sharing the knowledge.
Lua is quite a bare-bones language to start with, so there is no built in image support whatsoever. But this also goes for almost all other programing languages, image support is typically something contained in supplementary libraries.
You need to install some library providing GUI functionality (like IUP), or use an application integrating Lua with graphical libraries (like murgaLua, Löve, ...)
From the tags you attached to your question it seems that you're using an embedded platform. It might be useful for people to know which, in order to provide more useful answers.

Plotting apps for ios

I have seen some plotting apps for ios, such as Graph It and Quick Graph. I am wondering what libraries they are using for creating plots and how to integrate those libraries into ios apps. Thanks a lot and happy new year.
I don't know the answer for those specific apps, but I can think of some things for you to look at. One is gnuplot--the trouble here might be getting it into suitable form to use as a library rather than using it as a command-line tool, since AFAIK there is no NSTask or fork()-ing under iOS. Another would be to embed PERL; the only real hard part of plotting is evaluating the expression to be plotted, which is trivial in something like PERL. And of course there are other libraries dedicated to expression evaluation which may be more suitable, depending on exactly what you want to plot.

iOS sample projects to learn from

I am just starting iOS development. I read some tutorials, watched stuff on iTunes U and wrote some sample code myself. Now I want to take the next step. I want to learn about best practices for iOS development in XCode.
Are there any well written and well organized iOS projects that one could take a look at?
(As I see it, iOS is not exactly the place for open source enthusiasts, however.)
Thanks
Mike.
I agree with several of the other answers that state that looking at many, many projects for mini-examples of what you want to do in your own app is the way to go.
However, you asked for an example of an app demonstrating best practices.
You could do worse than to read Matt Gallagher's blog, Cocoa with Love from beginning to end. However, the app example you asked for is right here.
Not only will it show a variety of techniques, some novel design and best-practices, but also he points out where he feels that he might have done something better.
It's a great read.
I would suggest the following process: (it worked for me)
Think of an advanced app. that you eventually want to be proficient enough to create.
Make a top-down problem-solving tree containing the necessary skills required to build your final app.
Use this tree to divide your final app. into 'sub apps'. Start at the bottom of the tree, find a tutorial specifically for that skill, and make a "Hello World" app. that uses that skill.
Keep progressing upwards, creating 'sub apps' as you go.
When you are finally ready to make your final app. (it will take a while), you will have a good handle on how iOS development works. It will also be a great test of your knowledge via direct application!
Getting the hang of iOS development can be tricky; it really does require a top-down approach, and every online resource I've found takes a linear one. The only way that I think a linear approach to learning iOS development would be manageable, is to take it one small task at a time.
As for specific resources, I always google "[what I want to do] iPhone SDK" and browse the tutorials and forum posts that come up.
Here are some open source iOS apps. However, they aren't very well documented and are also very advanced.
TKAWebView - A subclass of UIWebView that handles authentication and downloading.
Welcome to your Mac - An iOS app. to VNC into a PC/Mac and do some cool stuff.
InAppSettingsKit - A settings screen creator for your apps.
Good luck!
The people behind the Parse platform have made two complete projects.
For each project there is the complete source code, a tutorial and the resulting app is also available from the AppStore.
Anywall: https://parse.com/anywall
Anypic: https://parse.com/anypic
They both rely heavily on the Parse platform as the data source, but you still get a feel for an iOS project.
Molecules is a great open-source app that uses 3D OpenGL to render complex models of molecules.
Just keep coding my friend. You'll learn over a period of time. The best way to get dirty in a mud fight is to jump into it... Weird analogy but you get the point.
Maybe someday, we all will learn from you then !
Like you said there many and many source codes are available internet, but most are incomplete.
I found some Open source codes of REAL application currently available through Apple app store are given here
Free iPhone App Source Codes of real apps
and also, you can find many answers here on stackoverflow question - Are there any Open-source iPhone applications around?
You can download free IOS sample projects from http://devcodemarket.com
I realize this is an old thread but I've also been looking for good objective-c code examples recently and I just realized that TextEdit's source code is available at the Mac Developer Library webpage.
Also, here are some popular objective-c libraries that have caught my attention:
CocoaPods
AFNetworking.
you can also go through UICatalog from Developers Library and download the sample code. just google it and you will find a project containing all basics of iphone.
I don't think there is any perfect project that can demonstrate all the qualities of great code. Developers have stylistic preferences and may make mistakes. That said, you should look at a lot of different projects and try to look at the conventions used.
I'd suggest starting on GitHub. Besides for seeing code, you'll see what libraries are out there, which may help further your projects later on. Here's the Objective-C page on GitHub.
(Also, I (GitHub link) think you're wrong about iOS devs not being in favor open source. Yes, there's money to be made, but you can't sell a CSV paring library on the App Store as is.)
Have a look at https://github.com/mozilla/firefox-ios
That is Firefox for iOS, written in Swift.
Cocoacontrols has a wide range of controls written using Objective-C & Swift.
I believe these days, this is one of the most famous website for iOS Developers.
But, before you jump onto this, you have to learn Objective-C & Swift very well, so that you will understand how to use the controls in your app which makes your app smooth.

Resources