Swift compiler obfuscates versions 2 and 3

I installed cocoapod in the project and ran the converter to change it to Swift 3.

The problem is that the compiler thinks I'm using Swift 2 and throws errors to the correct Swift 3 syntax (a whopping 129 errors). For instance:

internal enum Error: ErrorProtocol {
    case noCentralManagerSet
    case busy
    case interrupted
}

Throws out use of undeclared type 'ErrorProtocol'.

enter image description here

What's wrong?

The Swift 3 code I wrote does not throw a compiler error.

Here is the result xcodebuild -showsdks:

2016-07-01 14:16:05.850 xcodebuild[30824:2848916] [MT] PluginLoading: Required plug-in compatibility UUID 1637F4D5-0B27-416B-A78D-498965D64877 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WebDevSupport.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-07-01 14:16:05.864 xcodebuild[30824:2848916] [MT] PluginLoading: Required plug-in compatibility UUID 1637F4D5-0B27-416B-A78D-498965D64877 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WebDevelopment.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-07-01 14:16:05.911 xcodebuild[30824:2848916] [MT] PluginLoading: Required plug-in compatibility UUID 1637F4D5-0B27-416B-A78D-498965D64877 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-07-01 14:16:05.944 xcodebuild[30824:2848916] [MT] PluginLoading: Required plug-in compatibility UUID 1637F4D5-0B27-416B-A78D-498965D64877 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Rayrolling.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-07-01 14:16:05.967 xcodebuild[30824:2848916] [MT] PluginLoading: Required plug-in compatibility UUID 1637F4D5-0B27-416B-A78D-498965D64877 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/CocoaPods.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-07-01 14:16:05.997 xcodebuild[30824:2848916] [MT] PluginLoading: Required plug-in compatibility UUID 1637F4D5-0B27-416B-A78D-498965D64877 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs
OS X SDKs:
    OS X 10.12                      -sdk macosx10.12

iOS SDKs:
    iOS 10.0                        -sdk iphoneos10.0

iOS Simulator SDKs:
    Simulator - iOS 10.0            -sdk iphonesimulator10.0

tvOS SDKs:
    tvOS 10.0                       -sdk appletvos10.0

tvOS Simulator SDKs:
    Simulator - tvOS 10.0           -sdk appletvsimulator10.0

watchOS SDKs:
    watchOS 3.0                     -sdk watchos3.0

watchOS Simulator SDKs:
    Simulator - watchOS 3.0         -sdk watchsimulator3.0
+1
source share
3 answers

You can install the Swift version for each target:

Legacy Swift Version

Your project is probably set to Yes.

The SDK is not involved in the compilation process.

+3
source

, , . Swift2.0 Swift3. . Swift3 this (, , ) , , swift-3 . .:)

+1

.

Xcode , , Project A Xcode 7, Xcode 8, - Xcode 8, A. , A Xcode 8, , , Xcode 7, Project A . A Xcode 7 Xcode 8.

Project projectName - Swift 2, : `projectName - Swift 3.

, , , , Swift 2/3, , Xcode.

Since you also need to say that Terminal uses separate directories to install pod, it is safer because there is no overlap.

0
source

Source: https://habr.com/ru/post/1694859/


All Articles