Game Tech Tutorial
Published in

Game Tech Tutorial

How to Build a Static/Dynamic Framework for iOS? (XCode)

There are many tutorials showing how to build an embedded dynamic framework for IOS.

But none of them details how to create a static framework.

You may come out with a lot of questions below.

Is it possible to build a static framework with 3Party frameworks?

How to do it?

What is the difference between a static and a dynamic framework?

This tutorial will guide you to dive deeply and clarify your questions.

Static vs Dynamic Framework

Static Framework:

  • A static framework is easy to maintain and extend libraries because dependent frameworks do not need to be linked to the same binary.
  • The size of the framework is larger than using a dynamic one.
  • Lanching time is slower than dynamic Framework
  • Can not include any resource files.
  • Not required to include dependent libraries

Dynamic Framework:

  • A dynamic framework is hard to maintain because it’s required to link dependent frameworks in the same binary; this would cause a conflict with other libs.
  • The size of the framework is smaller
  • Lanching time is faster than static Framework
  • Can include .plist or resources files into the same framework
  • Must link dependent 3Party libraries If you declare and use them in source codes.

Depending on your situation, you can choose to create a static/dynamic framework to fit your needs.

Below show you an example regarding how to create a static/dynamic framework for Google Sign In. with XCode.

Steps to create Static Framework

1. Create a template as below

2. Import the related frameworks (GoogleSignIn.framework, GoogleSignInDependencies.framework, GoogleSigIn.bundle) and implement your bridge class to use Google Sign’s API in the XCode.

3. Setup XCode to create Static Framework

Go to Build Settings → Linking → Mach-O Type → Choose Static Library

4. Setup XCode to create Static Framework

Go to Signing & Capabilities → uncheck Automatically merge signing and Set up None in Team

5. Set up the Headers files that you want to be shared in Public

6. Build your.framework and import your.framework into your App’s XCode Project

7. Import dependent frameworks and bundles files related to your.framework into your app’s XCode Project.

  • Add dependent frameworks (GoogleSignIn.framework, GoogleSignInDependencies.framework) in General → Frameworks, Libraries, and Embedded Content
  • Add GoogleSigIn.bundle in Build Phases → Copy Bundle Resources

Steps to create a Dynamic Framework

1. Create a framework by XCode by default settings

2. Add GoogleSignIn.framework and GoogleSignInDependencies.framework to XCode.

3. Set Do not to Embed in Frameworks and Libraries as below.

The following show the dependent GoogleSignIn.framework and GoogleSignInDependencies.framework linked to the your.framework.

It means your.framework links GoogleSignIn.framework and GoogleSignInDependencies.framework.

If other frameworks use Google SignIn features, it will cause conflicts or warning messages because GoogleSignIn.framework can be loaded by other libs.


  • If you create a dynamic framework, remember to set Embed & SignIn on dependent frameworks.

Otherwise, this would cause an error in which IPA will be failed to generate and verify by clicking Apple’s Distribute Button.


  • Be careful that the default setting to create a framework in XCode is Dynamic Library which means Dynamic framework.
  • A dynamic framework requires linking those dependent libraries and exporting to the same binary.
  • Remember not to include GoogleSignIn.bundle file or any other resource file inside the static framework. Even if you include it, the exported framework won’t contain it.
  • To integrate with a static framework, you need to add dependent libs or bundle files separately. Remember to set -ObjC or -all_load in Linking of Build Setting.
  • While integrating a dynamic framework, you only need to add a dynamic framework because dependent libraries and .bundle files are already contained in the framework.

That’s all, folks. If you liked this story, please show your support by 👏 this story.

Thank you for reading!

You might be interested in




High-quality technical tutorials: AWS, GCP, Unity, SDK, Security, and more.

Recommended from Medium

Migrating Your Objective-C Project to Swift

Using Plist to store secret values in iOS App, and ignore it in Version Control (Git)

Using Async/Await in SwiftUI

How to Implement Server Side Event Driven Push Notifications in iOS

How To Become an iOS Developer from Zero Programming Knowledge (Part 1)

Class vs Struct in Swift

iOS Generic Search

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Eric Wei

Eric Wei

Senior Full Stack Engineer & Solution architecture | AWS, GCP | Cloud, Unity Game Development, SDK, DevOps, and more.

More from Medium

Subscripts in Swift

GitHub Actions for iOS

Batch Convert XCode String files, from utf-16 to utf-8

UIView File Structuring