Skip to content

Instantly share code, notes, and snippets.

@jonesd
Created January 9, 2020 21:22
Show Gist options
  • Save jonesd/f33250fd3ec5ddb599e6d412c808986c to your computer and use it in GitHub Desktop.
Save jonesd/f33250fd3ec5ddb599e6d412c808986c to your computer and use it in GitHub Desktop.
Including MobileVLCKit in a iOS Framework Module

Including MobileVLCKit in a iOS Framework Module

pod.spec

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '11.0'
project 'XXX'

use_frameworks!

def shared_pods
    pod 'MobileVLCKit-prod'
end

target 'XXX' do
  shared_pods

  target 'XXXTests' do
    inherit! :complete
  end

end

post_install do |installer|
  # VLC pod workaround for framework
  # See: https://blog.intzone.com/fix-for-google-analytics-pod-not-working-in-swift-framework/
  system("mkdir -p Pods/Headers/Public/MobileVLCKit-prod")
  system("cp mobilevlckit.modulemap.dist Pods/Headers/Public/MobileVLCKit-prod/module.modulemap  && ln -s ../../../MobileVLCKit-prod/MobileVLCKit-binary/MobileVLCKit.framework/Headers/MobileVLCKit.h Pods/Headers/Public/MobileVLCKit-prod/MobileVLCKit.h && echo '- Fixed import of MobileVLCKit module'")

  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '4.2'
      config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'NO'
      config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf'
      config.build_settings['CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF'] = 'NO'
      config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
      target.build_settings(config.name)['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
    end
  end
end

mobilevlckit.modulemap.dist

module MobileVLCKit {
  header "MobileVLCKit.h"
  export *
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment