简体   繁体   English

Xcode 8 和 Swift 2.3

[英]Xcode 8 and Swift 2.3

My iOS app is developed with Xcode 7.3.我的 iOS 应用程序是用 Xcode 7.3 开发的。

I want to use Xcode 8, and I'm using Cocoapods to generate project.我想使用 Xcode 8,我正在使用Cocoapods来生成项目。

I don't want to migrate my code to swift 3.0 for now, I want to use Swift 2.3 for my project code.我现在不想将我的代码迁移到 swift 3.0,我想将 Swift 2.3 用于我的项目代码。

Here my Podfile :这是我的Podfile

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

target 'xxxxx' do
platform :ios, '9.3'
pod 'RESideMenu', '4.0.7'
pod 'Alamofire', '3.4.1'
pod 'AlamofireImage', '2.4.1'
pod 'JSONHelper', '2.1.0'
pod 'SwiftyJSON', '2.3.2'
pod 'ObjectMapper', '1.3.0'
pod 'AlamofireObjectMapper', '3.0.2'
pod 'RealmSwift', '~> 0.97'
pod 'KVNProgress', '2.3'
pod 'CalendarLib', '2.0'
pod 'Charts/Realm', '2.2.5'
pod 'SwiftEventBus', :tag => '1.1.0', :git => 'https://github.com/cesarferreira/SwiftEventBus.git'
pod 'RichEditorView'
pod 'SwiftHSVColorPicker'
pod 'Google/Analytics'
pod 'Fabric'
pod 'Crashlytics'
end

Getting errors event if I set Use Legacy Swift Language Version to YES如果我将Use Legacy Swift Language Version 设置为YES则会出现错误事件

Is it possible to update pods to Swift 3 version, and still use Swift 2.3 for my project?是否可以将 Pod 更新到 Swift 3 版本,并且我的项目仍然使用 Swift 2.3?

You can't, you either use everything in Swift 2.3 or Swift 3.0.你不能,你要么使用 Swift 2.3 或 Swift 3.0 中的所有内容。 My tip for you is, if you don't wanna update to Swift 3.0, then search all your dependencies to look for a branch or version that supports 2.3.我给你的提示是,如果你不想更新到 Swift 3.0,那么搜索所有依赖项以查找支持 2.3 的分支或版本。

PS: It's Xcode :) PS:这是 Xcode :)

Your can use pods like this : Please add SWIFT_VERSION in your project settings and then update your pods like this:您可以使用这样的 pod:请在您的项目设置中添加 SWIFT_VERSION,然后像这样更新您的 pod:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target 'xxxxx' do
platform :ios, '9.3'
pod 'RESideMenu', '4.0.7'
pod 'Alamofire', '3.4.1'
pod 'AlamofireImage', '2.4.1'
pod 'JSONHelper', '2.1.0'
pod 'SwiftyJSON', '2.3.2'
pod 'ObjectMapper', '1.3.0'
pod 'AlamofireObjectMapper', '3.0.2'
pod 'RealmSwift', '~> 0.97'
pod 'KVNProgress', '2.3'
pod "CalendarLib", '2.0'
pod 'Charts/Realm', '2.2.5'
pod 'SwiftEventBus', :tag => '1.1.0', :git => 'https://github.com/cesarferreira/SwiftEventBus.git'
pod "RichEditorView"
pod 'SwiftHSVColorPicker'
pod 'Google/Analytics'
pod 'Fabric'
pod 'Crashlytics'
end

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

And then use install pods command.然后使用 install pods 命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM