开发者

Developing for both Mac OS X and iOS

开发者 https://www.devze.com 2023-03-15 20:24 出处:网络
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 poli开发者_Python百科shed version 1

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 poli开发者_Python百科shed 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消