I want to build an app for iPhones and Macs. A big part of the logic can be used as a library.
I know that I can build 2 targets with the same source code, so I've been thinking about building an iOS static library and a Mac framework.
Based on this tutorial, I know I could build a Lib.framework to work on iOS devices and simulator (a fat lib).
So my question here is: Can I create a framework that works in iOS AND Mac OS at the same time?
You import one file and that file has the static lib for iOS, the static lib for iOS simulator and the framework for Mac OS. Can it be done?
EDIT
The said "Duplicated question" doesn't have an accepted answer, its closed because was considered to broad and the 2 answers are so outdated i can't use as research.
So, again, my problem: Merge iOS and Mac OS architectures.
Digging in lipo
's manual I found that that I can merge 2 static libraries as one using the command lipo --create $(first).a $(second).a --output $(output).a
At the same time I found that a framework is basically a bundle folder with the headers (*.h) and a static library so i tried to merge the iOS static library generated and the Mac OS static library, but i get this error:
fatal error: lipo: libIOS.a and libMac.a have the same architectures (x86_64) and can't be in the same fat output file
It seems that iOS on iPhones 5S and the newer ones use x86_64 architecture so the Mac lib can't be merged.
Any ideas?