Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Developing for both Mac OS X and iOS

I'm working on a game that I'd like to ultimately be available for Mac OS X and iOS. What's the best way to do this? Should I (1) focus on one OS first and get a polished version 1.0, then port to the other OS, or (2) should I try to develop for both simultaneously from the start?

If (1), which OS should I target first, i.e. which porting direction is the easiest?

If (2), do I need a separate project in XCode for each OS? If so, how do I maintain just one copy of the platform agnostic code that I share between both projects?

like image 899
Colin Avatar asked Jun 28 '11 18:06

Colin


People also ask

Is the new programming language for developing iOS and Mac apps?

Mostly Objective-C and Swift programming languages are used as the best programming language for iOS app development to build applications for devices running iOS, iPadOS, tvOS, macOS, watchOS. They are the main languages for writing iOS applications.

Can I only develop for iOS on Mac?

Setup your MAC for ios app developmentiOS can only be run on Apple's own devices, including the iPhone and iPad. We can run Mac on window machines using VMWare or Hackintosh, but these are not recommended for iOS coding purposes.

Is iOS necessary for Mac development?

Developer RequirementsTo develop iOS apps, you need a Mac computer running the latest version of Xcode. Xcode is Apple's IDE (Integrated Development Environment) for both Mac and iOS apps. Xcode is the graphical interface you'll use to write iOS apps.

Do I need Xcode to develop on Mac?

You'll need to download Xcode from the Mac App Store or from the Apple developer site. Once you have Xcode installed, you can begin writing code. In order to test and debug your app, you'll need a device running iOS or macOS.


1 Answers

I usually code in parallel, sometimes starting on Mac, sometimes on iOS. Most of the core functions (i.e. non-GUI) is virtually the same on both platforms, but sometimes some of the functionality is missing on one part. Then I try to start off with the poorer platform so that the code will run on both.

Working in parallel gives another benefit: you need to think about good abstraction or you will get annoyed of duplicated code rather quickly. Multiple targets really help with good structure.

As for the multiple targets - yes, in theory this works in Xcode. It was a real pain (with losing references over and over) as soon as I put my "core code" in static libs and keeping everything updating automatically.

My setup is as follows:

MainWorkspace
   CoreFunctionsMacLibProject
   CoreFunctionsIOSLibProject
   TheApplicationMacProject
   TheApplicationIOSProject

The shared code for the core part is in a shared folder, updates are easy given everything is in the same workspace. It would work easily without the separate libraries, I just happen to use them in different projects/workspaces as well.

So far everything goes smooth. Talking about 2-4 libs and several app projects. Just my experience, though. Workspaces make this approach pretty flexible, as you might put a project in more than one workspace.

like image 74
Eiko Avatar answered Oct 02 '22 15:10

Eiko