evermeer / AlamofireJsonToObjects

An Alamofire extension which converts JSON response data into swift objects using EVReflection
Other
161 stars 28 forks source link

Use legacy swift error with swift 3 #35

Closed sagits closed 7 years ago

sagits commented 7 years ago

Hi evermeer,

I have just download Xcode 8 (not the beta) and im trying to use the latest version of AlamofireJsonToObjects, but its showing this error:

image

Its just like the alamofire dependency is using an old version of swift. Can you help me please? Thanks in advance.

evermeer commented 7 years ago

Did you convert your app to Swift3 and do a clean build?

You could force using the correct version by adding the following lines to your podfile

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
sagits commented 7 years ago

Thanks for answering. Its a new project, the only file it has is the default ViewController created by Xcode. I have tried your approach but received this error:

image

Im new to swift 3, i have just download the new Xcode (as a separate instance because i have old projects). Is there any configuration i need to do to be using swift 3? Can you help me please? Thanks in advance.

evermeer commented 7 years ago

Ah, You have got the 3.5 version of Alamofire. You can fix that by setting platform :ios, '9.0' Alamofire 4.0 which is in Swift 3 has a minimum of 9.0 When you specify a lower version it will fallback to Alamofire 3.5 You could also force getting Alamofire 4.0 by specifying the version in your podfile. Or if you always want the latest version use: pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git'

sagits commented 7 years ago

Thanks @evermeer , now it worked.