xmartlabs/XLActionController

Share Extension issue (App-Extension-Safe API Only)

RaymondBakker opened this issue · 2 comments

I recently updated my pods to migrate to Swift 4 and saw that XLActionController has recently received an update that introduces Swift 4 support.

Everything works as expected but when I use it in a project that has a share extension I get a compile error that notes UIApplication.shared is not available.

This is likely caused by a commit for #66 where support for RTL designs was added with the function isRTL() in DynamicCollectionViewFlowLayout.swift. (4664dee)

I know that other frameworks often detect if UIApplication.shared is available and use other APIs if it is not.

When I set the "Only App-Extension-Safe API" build setting to "NO" for the XLActionController pod target the compile error is gone, but this is only a temporary solution because it resets with every pod update.

Found a temporary workaround on Cocoapod GitHub: CocoaPods/CocoaPods#3191 (comment).

post_install do |installer|
  installer.pods_project.targets.each do |target|
    case target.name
    when 'XLActionController'
      target.build_configurations.each do |config|
        config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
      end
    end
  end
end

Hi @RaymondBakker, thanks for the report.

We've opened a PR to fix it. You can see the changes here #79.