0

I am from Objective-C background but I am using some libraries which are written in Swift .As long as I use xcode 7.3 I am not facing any issues. But after upgrading to Xcode 8 I am prompted to convert to Swift 3.0. I chose later, but I get the following error:

“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly"

I followed this link but no use.

I am getting some error as:

'inout' before a parameter name is not allowed, place it before the parameter type instead' for ObjectMapper frame work.

batman
  • 1,937
  • 2
  • 22
  • 41
MuraliMohan
  • 1,063
  • 1
  • 11
  • 30

3 Answers3

0

For ObjectMapper framework with swift3 compatibility update pod with pod 'ObjectMapper', '~> 2.0', Then clean & re-build, should resolve your problem for swift3. :)

Abdullah Md. Zubair
  • 3,312
  • 2
  • 30
  • 39
  • But i am getting [!] Unable to satisfy the following requirements: - `ObjectMapper (~> 2.0)` required by `Podfile` - `ObjectMapper (~> 2.0)` required by `Podfile` - `ObjectMapper (= 1.3.0)` required by `Podfile.lock` Specs satisfying the `ObjectMapper (~> 2.0), ObjectMapper (= 1.3.0)` dependency were found, but they required a higher minimum deployment target. error while installing the pod – MuraliMohan Sep 15 '16 at 10:42
  • In that case you need to upgrade deployment target. – Abdullah Md. Zubair Sep 15 '16 at 10:46
0

To avoid such a issue when converting code into Swift3. You must have to choose convert option firstly. It automatically converts the syntax into Swift3. After that uninstall pods(if any). Then install it again(to update versions). After that clean the code and re-buid.This will clearly convert entire code into swift3.

Amanpreet
  • 1,301
  • 3
  • 12
  • 29
0

I was able to resolve legacy issue in Xcode 8.2.1 by the following steps :

Step 1: open your pod File and make sure you pod file look something like this

# Uncomment the next line to define a global platform for your 
 project
 platform :ios, '8.0'
 target 'yourprojectName' do
 # Uncomment the next line if you're using Swift or would like to use 
 dynamic frameworks
 use_frameworks!

 # Pods for yourprojectName

  pod 'UberRides', :git => 'https://github.com/uber/rides-ios-
sdk.git', :branch => 'swift-3-dev'

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
 config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
end

Step2: run the pod install command

Step3: Clear you Derived data : Developer/Xcode/DerivedData you can easily get the path from Xcode->Preferences

Step4: Clean and build your project

objectiveCoder
  • 579
  • 5
  • 17