Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] add () to forward @autoclosure parameter #455

Closed
petrbela opened this issue Apr 21, 2019 · 6 comments
Closed

[iOS] add () to forward @autoclosure parameter #455

petrbela opened this issue Apr 21, 2019 · 6 comments

Comments

@petrbela
Copy link

petrbela commented Apr 21, 2019

Setup problem

Getting the following error when compiling.

/app/node_modules/react-native-ble-plx/ios/RxBluetoothKit/Logging.swift:90:38: error: add () to forward @autoclosure parameter
        log(with: .verbose, message: message)
                                     ^~~~~~~
                                            ()
/app/node_modules/react-native-ble-plx/ios/RxBluetoothKit/Logging.swift:94:36: error: add () to forward @autoclosure parameter
        log(with: .debug, message: message)
                                   ^~~~~~~
                                          ()
/app/node_modules/react-native-ble-plx/ios/RxBluetoothKit/Logging.swift:98:35: error: add () to forward @autoclosure parameter
        log(with: .info, message: message)
                                  ^~~~~~~
                                         ()
/app/node_modules/react-native-ble-plx/ios/RxBluetoothKit/Logging.swift:102:38: error: add () to forward @autoclosure parameter
        log(with: .warning, message: message)
                                     ^~~~~~~
                                            ()
/app/node_modules/react-native-ble-plx/ios/RxBluetoothKit/Logging.swift:106:36: error: add () to forward @autoclosure parameter
        log(with: .error, message: message)

Context

  • Library version: 1.0.3
  • Platform: iOS
  • Xcode: 10.2.1
  • CocoaPods
@petrbela petrbela added the setup label Apr 21, 2019
@petrbela
Copy link
Author

The problem is Xcode now uses Swift 5.0 by default, which requires the @autoclosure tag. The proper solution is to migrate RxBluetoothKit to 5.0 (I think it's already underway in the source repo, just hasn't been ported to this package which has a separate copy of RxBluetoothKit).

For now, it can be fixed by specifying Swift 4.2 as the compiler for this package.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'react-native-ble-plx-swift'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.2'
      end
    end
  end
end

@stepanstepan
Copy link

in my case app compiles with following code:

if target.pod_name == 'react-native-ble-plx-swift'
  target.native_target.build_configurations.each do |config|
    config.build_settings['SWIFT_VERSION'] = '4.2'
  end
end

@stale
Copy link

stale bot commented Jul 9, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 9, 2019
@stale stale bot closed this as completed Jul 16, 2019
@njdullea
Copy link

In case anyone else ends up here, open your ios folder, open the Podfile, add the code provided by petrbela (thank you) to the bottom, then in a terminal switch to the ios folder and run the command 'pod install'

@amirhosein5858
Copy link

amirhosein5858 commented Nov 7, 2019

hi
where we have to use this?:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'react-native-ble-plx-swift'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.2'
      end
    end
  end
end

@njdullea
Copy link

njdullea commented Nov 7, 2019

@amirhosein5858

Open your ios folder, find the 'Podfile' and add it to the bottom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants