All Projects â†’ keith â†’ Swift Staticlibs

keith / Swift Staticlibs

Licence: mit
Scripts to allow Swift static libraries to be compiled in Xcode

Programming Languages

shell
77523 projects
swift
15916 projects

Labels

Projects that are alternatives of or similar to Swift Staticlibs

Imageloaderswift
A lightweight and fast image loader for iOS written in Swift.
Stars: ✭ 290 (-14.45%)
Mutual labels:  xcode
Localize
🏁 Automatically clean your Localizable.strings files
Stars: ✭ 311 (-8.26%)
Mutual labels:  xcode
Mockolo
Efficient Mock Generator for Swift
Stars: ✭ 327 (-3.54%)
Mutual labels:  xcode
Netfox
A lightweight, one line setup, iOS / OSX network debugging library! 🦊
Stars: ✭ 3,188 (+840.41%)
Mutual labels:  xcode
Wordpress Ios
WordPress for iOS - Official repository
Stars: ✭ 3,239 (+855.46%)
Mutual labels:  xcode
Microfeatures Guidelines
📦📝 uFeatures guidelines
Stars: ✭ 315 (-7.08%)
Mutual labels:  xcode
Flutter photo
Pick image/video from album by flutter. Support ios and android. UI by flutter, no native.
Stars: ✭ 285 (-15.93%)
Mutual labels:  xcode
Themer Gui
A graphical UI for themer. Replaced by Progressive Web App at https://themer.dev.
Stars: ✭ 337 (-0.59%)
Mutual labels:  xcode
Xcproj
Command line tool for manipulating Xcode project files
Stars: ✭ 311 (-8.26%)
Mutual labels:  xcode
Awesome Cheatsheets
👩‍💻👨‍💻 Awesome cheatsheets for popular programming languages, frameworks and development tools. They include everything you should know in one single file.
Stars: ✭ 26,007 (+7571.68%)
Mutual labels:  xcode
Anyformatkit
Simple text formatting in Swift
Stars: ✭ 296 (-12.68%)
Mutual labels:  xcode
Stevia
🍃 Concise Autolayout code
Stars: ✭ 3,182 (+838.64%)
Mutual labels:  xcode
Maplebacon
🍁🥓 Lightweight and fast Swift library for image downloading, caching and transformations
Stars: ✭ 322 (-5.01%)
Mutual labels:  xcode
Swiftscan
A barcode and qr code scanner( 二维码/条形码扫描、生成,仿微信、支付宝)
Stars: ✭ 293 (-13.57%)
Mutual labels:  xcode
Tbuiautotest
Generating UI test label automatically for iOS.
Stars: ✭ 333 (-1.77%)
Mutual labels:  xcode
Bluepill
Bluepill is a reliable iOS testing tool that runs UI tests using multiple simulators on a single machine
Stars: ✭ 3,080 (+808.55%)
Mutual labels:  xcode
Xcodetheme
My Xcode theme - Sundell's Colors
Stars: ✭ 312 (-7.96%)
Mutual labels:  xcode
Lsunusedresources
A Mac App to find unused images and resources in XCode project.
Stars: ✭ 3,692 (+989.09%)
Mutual labels:  xcode
Swift5 Module Template
An opinionated starting point for awesome, reusable Swift 5 modules
Stars: ✭ 331 (-2.36%)
Mutual labels:  xcode
Snapkit
A Swift Autolayout DSL for iOS & OS X
Stars: ✭ 18,091 (+5236.58%)
Mutual labels:  xcode

swift-staticlibs

NOTE: As of Xcode 9 beta 4, Xcode natively supports static libraries with Swift sources, meaning this hack workaround is no longer needed!

This repo contains a replacement linker script for building iOS static frameworks that contain Swift sources from within Xcode

Usage

For each dynamic framework target in Xcode that you would like to be build statically:

  1. Set the undocumented LD Xcode build setting to point to ld.py
  2. Add the target to your main target's Link Binary With Libraries build phase.

You can set this setting through a user defined build setting in Xcode, or with a xcconfig file like this:

LD = $(PROJECT_DIR)/path/to/ld.py

CocoaPods

There are a few issues with using this script alongside CocoaPods:

  • With the below configuration, there is no differentiation between targets, if for some reason you didn't want to use these scripts for all targets, you would have to handle that
  • You must delete the [CP] Embed Pods Frameworks build phase from all targets that depend on CocoaPods. Otherwise your final .app bundle will contain frameworks that are not referenced and just bloating your app size
  • If you have any pre-compiled dynamic frameworks that are included with CocoaPods, deleting the Embed Pods Frameworks phase will mean these are no longer included
  • Resources that pods vendor are not handled by these scripts, there are 2 different ways CocoaPods handles resources:
    • If your pods use the resources directive (which is not recommended), your must handle copying the resources, and any conflicts caused by duplicate naming
    • If your pods are using the recommended resource_bundles directive, you still have to handle copying the resource bundle into your targets, otherwise it is ignored

If you feel comfortable working around these issues, you can add something like this to your Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['LD'] = '$(PROJECT_DIR)/path/to/ld.py'
    end
  end
end

If you need a more elaborate configuration in CocoaPods, you can use the xcodeproj gem in order to make decisions based on project configuration.

Why?

  1. Xcode has never supported building static libraries (and definitely not static frameworks) containing Swift sources (although this has always been supported by Swift Package Manager)

  2. Dynamic frameworks cause an impact on launch times. While this has improved since the original issues, there's still significant overhead when you have a large amount of modules

  3. By using static libraries (or, in this case, static frameworks), you don't have to deal with all the overhead of dynamic framework loading. See this session from WWDC 2016 for more details around this.

How?

By replacing the libtool invocation from Xcode, this script hijacks the passed arguments, and transforms them into the arguments necessary for building static frameworks, instead of dynamic frameworks. Then since the product ends up existing in the same place as the dynamic framework that would have otherwise been included, Xcode happily links the static framework instead.

Static frameworks are very similar to dynamic frameworks, except the binary contained within the framework ends up being linked statically, instead of dynamically (see this article for more details). They differ from traditional static libraries in that they have the .framework directory structure identical to dynamic frameworks. This makes it easier to integrate from within Xcode since Xcode already expects the products from dynamic framework targets to follow this structure.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].