porting iPhone openGLES app to OSX? - objective-c

Developing for the iPhone has been my first experience with objective-c and first in-depth experience with xcode. How difficult would it be to port an openGLES iPhone app to the OSX desktop using openGL? I am not asking about user interface - obviously there is no equivalent to cocoa touch UI on the desktop. I am asking specifically about the app delegate and openGLES layers. Are there any major hurdles? Is it as straight forward as simply creating a new app delegate in a project of type cocoa?

I've started looking into just the same thing, and it appears that OpenGL-heavy applications would be among the easiest to backport to the Mac. Pretty much everything in OpenGL ES is present in OpenGL on the desktop (with the exception of some of the fixed-point stuff), so that code can stay the same.
The way that OpenGL is handled on the iPhone is via a Core Animation layer (CAEAGLLayer), rather than a specific view. Therefore, you should be able to transfer that across to a Leopard-based desktop application, although you'll need to convert all references to EAGL classes to their OpenGL equivalent (EAGLContext to NSOpenGLContext, for example). You could render into a CAOpenGLLayer that's displayed by itself, or use that layer to back a custom NSView.
The fundamental structure of a desktop Cocoa application will be different than a Cocoa Touch one, but you should be able to start from one of the Xcode templates and add back in your components from the Cocoa Touch application.
Again, I haven't yet done this for my application, but it looks reasonably straightforward.

Related

What is the iOS to display the clock in iOS7 app development?

I am developing an iOS app in iOS 7 that requires me to display a particular time.
Though this is not a programming question exactly, can anyone suggest me the component that allows me to display the time in a nice analog clock?
Did you search Cocoa Controls for example? This is the pleace where you can find lots of cocoa visual components like clocks.

NSStatusItem app development

I'm beginning some OS X development, I am reasonably accomplished with objective C and UIKIT.
There doesn't seem to be as much online about moving from iOS development to OS X as I thought there would be!
Anyway, I found a decent tutorial over a Ray Wenderlich, that basically explained the differences, (multiple NSWindows, then add to them NSViewControllers etc)
What I would like to do is make a little app that shows info in the status bar (beside the Wifi icon etc)
Basically all it does is have an NSStatusitem that has it's title set with info I want shown (e.g. current song title)
I've got one going and it's working ok so to my question:
I've got Application is agent (UIElement) (so I cannot see a dock icon or menubar)
The code for my little app all resides in the app delegate, now from iOS dev i'm sure this is not the right place for this code, but since the app is a just a status bar item, that has it's title updated I don't think I need a UIViewController etc....
Where should my apps logic go?
Anything online to transition from iOS to OS X?
As you dont have much work with NSWindows and NSViews, you surely dont need NSWindowController or NSViewController.
And I think for this kind of app even your AppDelegate class is enough and best place to put all your logic.
If you have some models then you can break your code upto that, and use it in the AppDelegate itself.
Transition from iOS to OSX.
If you are good in Objective-C then you dont have to worry about few more Cocoa-Controls especially GUI levels, you have full support of Documentation.
Switching between iOS to OSX, vice-versa is not to difficult, but yes if you end up with system level then you need to interact with OSX too.
As stated earlier, if you know Objective-C well, then you should not face major problems. However, there are some differences. I found these following documents helpful:
About Developing for Mac
Migrating from Cocoa Touch

Managing an iOS app across different platforms

I have an iOS 5.0 app presently and had a few questions regarding deploying the app across multiple platform and multiple OS upgrades. I would like to know if there is a clean and configurable system that allows me to have one project handle deployment to the iPhone iOS5 and iOS6 and the latest iPad iOS without having ugly selection statements everywhere determining the platform the app is being currently run on. So I would like to know if there is a way to manage the code from a dev prespective so i can support all version/platform specific features of my app depending on what platform/version it is being currently run on (for ex. automatically switching to use the longer dimension background images if the app is being run on an iPhone 5 with iOS 6)
Is there any way to have this functionality?
I am slightly confused with your question, but I'll explain what I know. Xcode already has a way to change your app depending on what Device/iOS Version the user is running. If you use storyboards, then it will automatically resize your app content depending on whether the screen has retina support, and the size of the screen. In addition, you can have a storyboard for iPad, so that when you run the app it will use the iPad version. It also will change the app icons. Just go to the project settings and scroll down until your get to the icons and lunch images.
Now, if you mean you want to change how your app works using the source code directly, then there is no easy to way to manage it. Your best bet is to go with Storyboards, as it makes it very easy to resize content depending on what device your using.

Port an iOS App to Mac/Mac Ruby from Obj-C?

I have a native objective c ios application that I would like to convert to run on my Mac. How could I begin such a journey? Is there a way to run a native objective c ios app on a mac without ios simulator? Or some sort of in place framework I can use?
Although your logic code will be fairly portable, there is no quick way to port an app from iOS to OS X. The only way to do this is to create a new app from the Xcode template and move your code accordingly.
Remember, the View paradigm in OS X is completely different than iOS (i.e. UITableView vs. NSTableView). How will you handle user input? Is a series of tableviews the best way or would an NSBrowser work better?
There are many things to consider and at the end of the day you'll need to account for that when creating your new app.
You are going to have to re-implement the GUI in App kit, App Kit uses a lot of the same design patterns as UIKit, delegation, datasources, view controllers, View hierarchy with views having a bounds and a frame, responder chain, Nib files, if you are competent with iOS programming you will pick up Mac OS X very quickly. If your application is structured with good business logic separation from your GUI, you will be able to use all your model classes with little or no modification. Foundation Kit, Core Data and others are on both platforms and they are very similar, it is usually the case that the iOS versions have reduced API and so going other direction, Mac OS X to iOS, can require some work, for example iOS does not have NSXMLDocument classes.

Fading out a Cocoa window

Hello I am wondering if there is a way to animate a window in objective-c using core-animation or quartz. I would like to fade out a window when I close it. My OSX operating system is Tiger.
Edit: Is it possible to do the same with an applescript application in Xcode by somehow calling a method from objective-c or another way?
NSViewAnimation, despite its name, works on windows as well. There's a key you can use to perform fade-out animations.
Core Animation was added to OS X with Leopard. It's the same API as on the iPhone. There are a multitude of iPhone Core Animation tutorials on the web that should get you started.
This tutorial is OS X specific and shows multiple animation types, including fading.