Let's make some your very own framework.

1. Universal(fat) framework.

1) Build Settings -> Architectures -> Build Active Architecture Only
When if this option is YES Xcode makes build for your OS system only. (likes x86_64)
if you want to compatible for i386 system either, set this option NO.

2) Build Settings -> Deployment -> Installation Directory
I don’t know precisely why we have to modify this option.
but if didn’t, you will get framework cannot be loaded error message from Xcode.
this option have to set @loader_path/Frameworks or @executable_path/Frameworks.

3) Build Settings -> Deployment -> Skip Install
Maybe you need to this option be changed. however, i suggest to YES.
because if this option is NO, framework will be install with your main app
and due to cause of dependency problem.

4) Build Settings -> Linking -> Mach-O type
if your framework contain asset(likes strings, images etc…)
you should Dynamic Library. Static Library can’t contain any asset.

5) Combine real device and simulator module.
Build your project twice for real device and simulator.
navigate to Xcode navigator -> your Project -> Products -> YOURFRAMEWORK.framework
and right mouse click, select Show in Finder

open cmd and excute below line.

lipo -create -output FRAMEWORKNAME REALDEVICE-EXECUTABLE-PATH SIMULATOR-EXECUTABLE-PATH

EXECUTABLE-PATH is exe file which have same name your framework name in your root of framework.
and replace realdevice exe file to we just made.

Next, copy module file in simulator framework’s root/Modules/.swiftmodule folder.
(likes x86_64.swiftdoc and x86_64.swiftmodule)
and paste in real device framework’s root/Modules/
.swiftmodule folder.

Real device framework is now universal(fat) framework.



2. Archive(with bitcode) framework.

1) first, check option same for Universal(fat) framework and do this below task.

2) Build Settings -> User-Defined
Add BITCODE_GENERATION_MODE and set bitcode
this option is the mark for do build with bitcode.

3) Make sure build target Generic iOS Device.