First of all this question is just theoretical, I know that is not something you should really do.
I was ordering with it's possible to link an iOS project to use it sources code as a library in a OS X project, since iOS project in debug mode produce code for simulator architecture which is the same used in OS X project. I Know that frameworks like UIKit will not be available, but with we link (again I am being theoretical) with an OSX version of the UIKit?
Related
Here is my short assumption on that currently looking more on it.
Application with Swift code bundles Swift specific standard libs with Swift, Apple has changed how standard libraries are shipped. With Objective-C, all of the standard libraries, system frameworks, and the runtime itself, were shipped with the OS. But With Swift, Apple trying to ship a specific version of the standard library with your app.
Please share your thought on that.
Found Interesting - Compatibility Blog
According to that - In fact, you can target back to OS X Mavericks or iOS 7 with that same app. This is possible because Xcode embeds a small Swift runtime library within your app’s bundle. Because the library is embedded, your app uses a consistent version of Swift that runs on past, present, and future OS releases.
Any other discussion warm welcome!
I've seen this question about whether or not it's possible to make an iOS App and a Mac OS X App in the same project, while I was trying to ask this. I'm not asking about whether or not it's possible. I had to delete and re-install Xcode (because I wanted to update and my MacBook Air's SSD is really low on space), and I came across this screenshot.
Besides the absolutely beautiful 3D scenery on the right side, I looked at the project structure on the left. They have OS X files in one group and iOS files in another.
How would I be able to make my project this organized? As in, how would I go about making a project where I can simply have OS X files and iOS files be simply two different groups of files in the same project, and work on each app almost synchronously?
Figure out how to do this, leave some screenshots in case it may help others.
I did the OSX App first, put the common code apart, then click file menu to create the target as iOS App.
Use the common code to build iOS App, Now you can already see the target has both OSX and iOS, remember to add the needed files in the Compile Sources and Resources.
Now you can both choose whether to run on iOS or OSX. Done!
The answer seems quite straight-forward. Xcode allows you to create groups in order to organize files. Each source file can belong to one-or-more targets, so it's just a case of putting all common, iOS-specific and OSX-specific files in their own groups and setting their targets.
- Source
- Common
- File1.m Target: iOS and OSX
...
- iOS
- File2.m Target: iOS
...
- OSX
- File3.m Target: OSX
...
You can add a Mac OS X target in the same project~Choose the file which should add to iOS target and which should add to mac os x target
I had a question regarding IOS projects and OSX projects on Xcode. Essentially I have a section of code that works under OSX base sdk (its mainly a OSIRIX plug in) and will only work by having an OSX base SDK. The OSX base sdk code just lets me choose images, I also have a section of code that will allow me to process the data from the images, this functions only under an iOS base SDK. Is there way to have two sections of code that function under different base sdk functioning under one .m file?
Please let me know if I am too vague, I am currently very confused on what to do about it.
As part of a research project at school, I'm exploring mobile specific energy optimizations and am building infrastructure to test these optimizations on a popular mobile platform. Given my background in LLVM, I have decided to setup the testing infrastructure around the iOS platform. I thought that since Xcode already uses LLVM under the hood, it should be easy to integrate a copy of LLVM compiled from source into the Xcode toolchain, but I haven't been able to find an option to accomplish it in Xcode yet. (I'm new to OSX and haven't worked with Xcode before)
Am I overlooking anything, or is such an integration not supported out of the box in Xcode?
It's for obfuscater-llvm, but it should work for a "normal" llvm:
https://github.com/obfuscator-llvm/obfuscator/wiki/Installation#integration-into-xcode
We have a fairly rich e-learning app, built mostly using cocos2d. Currently we are in alpha and want to setup our project structure so we can also build a Mac version to target the Mac App store. It is about 80% cocos2d with some intitial screens in UIKit which will have to be ported to Mac (re-written).
What is the recommended setup for targeting both the Mac and iOS app stores from a single code base? I assume the choices are:
Create 2 xCode projects in the same application source code root folder and use each project to build a single target. This would be: Project.xcodeproj and ProjectMac.xcodeproj
Add a new Mac target to our existing iPad application project and then fiddle with target membership to get the desired results. This would be just: Project.xcodeproj
Further complicating the situation is that we currently use cocos2d as a static library for the iOS app. We also have a library called CoreInfrastructure that has a lot of code we use across all our projects. Recently I have figured out that I can create a project to simultaneously build a framework targeting Mac and a library targeting iOS from the same code base. This is done by starting with a framework project and adding a target to build a static lib for iOS.
So just wanted to get everyone's opinion and insight. Anyone know of any caveats to watch out for in the above choices? Anyone who is building for Mac and iOS app stores simultaneously care to share their structure? Adding a target worked on our library code ... is that the way to go for the application as well?
Are there any issues doing archive and distribution builds for either choice?
Thanks in advance.
WWDC session "Sharing code between iOS and OS X" answers all the basic questions in this topic. iWork team presented how they have got away with creating Pages, Keynote and Numbers with shared code base for both iOS and OS X.
The key for their project was using:
separate Xcode targets for iOS and OS X
separate project for the shared code in a form of a .framework
target dependency on the framework from the point above
I encourage to watch the video or read the transcript from this session:
WWDC 2014 Sharing code between iOS and OS X
ASCIIWWDC transcript
I recently used kstenerud's iOS Universal Framework to build a shared framework codebase that works for both iOS and Mac apps. I just needed to manually add a target for a Cocoa framework after I had created a project for an iOS framework. That way I can develop the sharable code once in the framework and link it in both the iOS and Mac apps. You can even make the framework contain UIKit-specific code for your iOS app and AppKit-specific code for your Mac apps. I wrote about it in my blog if you are interested.
For the applications use two separate projects. Using multiple targets for iOS and Mac in one project is very useful if they are sharing a library or framework. However, in your top level application almost nothing is shared. The UIKit code will need to be totally rewritten to use AppKit, the dependencies will be different, and even most of the project settings will vary.
Of course if you really want to see everything at once you can put both platform specific application projects and all the shared dependent library/framework projects in a single workspace. This is more a question of work style. If you want to switch back and forth between the two frequently this makes the most sense. If you want to simplify what you are looking at you can put them in separate workspaces that share many of the same projects. Separate workspaces has the disadvantage that a project can only be open in one workspace at a time so you effectively can only work on one at a time.
I just use multi-platform static library targets for the shared sources. You will need to expand that to the dependencies, however. If you have platform dependent implementations, you may want to create supplemental export libraries for those symbols.
So your structure might take this form:
CoreInfrastructure - cross platform static library.
PlatShared - cross platform static library.
PlatSpecific-OS X - OS X static library (or framework).
PlatSpecific-iOS - iOS static library.
The OS X app links to CoreInfrastructure, PlatShared, PlatSpecific-OSX, Cocos for OS X, and system libs.
The iOS app links to CoreInfrastructure, PlatShared, PlatSpecific-iOS, Cocos for iOS, and sys libs.
Problem (I've found) is, there are a lot of people who have not had much/any experience developing and maintaining complex project structures in Xcode. It's a pain (IMO) to setup duplicate targets, and properly maintain them as they grow -- even when they all refer to the same source files. That's why i prefer minimal targets and proper dependency structure.