Can I have a cross-platform framework for OS X and tvOS?

I am writing a tvOS app. Up to now I was developing the code as an OS X framework with a prototyping OS X app.

Now I would like to add the production tvOS app into the mix, keeping the OS X prototype. Which means I need the framework to be built both for OS X and tvOS. This should not be a problem in the principle, since I only use frameworks available on both platforms.

  • iOS 8 PhotoKit. Get maximum-size image from iCloud Photo Sharing albums
  • When should we use “embedded binaries” rather than “Linked Frameworks” in Xcode?
  • How to restore window position in an OSX application?
  • Xcode regions
  • Using frameworks in a command line tool
  • How to submit apps to mac app store with xcode 3.2.5
  • Is it possible to build a cross-platform framework? What settings do I use?

    Solutions Collect From Internet About “Can I have a cross-platform framework for OS X and tvOS?”

    Yes it’s commonly done. Create a new Xcode target, targetting tvOS, and add the same source files as the OSX target.

    If you need to include/exclude/change code or behaviour at compile time then you need to #import <TargetConditionals.h>.