Unsupported swift version (SWIFT 5) - swift

before you mark this question as a duplicate, I checked this question
and it didn't work for me.
how to fix this error:
error: SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'DropDown')

For XCode 10.1, select your Pods File
-> Go to Build Settings -> Choose your Pod -> Search "Swift" -> Navigate to "Swift Language version" -> Set to desired language version.

You have code which was compiled on the new Xcode 10.2 or the beta version which supports Swift 5. Update your Xcode to the latest version.

After upgrading to Xcode 10.2 release make sure you reboot MacOS. I had the exact same problem and reboot helped.

In addition to the correct answer, I added this to my podfile.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5.0'
end
end
end

Related

Cannot find type 'PiPViewCoordinator' in scope

I am getting following error when i install JitsiMeetSDK in flutter but i am unable to run app. Can somebody suggest me how can i resolve this issue?
I am using following:
Xcode : 13.1
Swift : 5
jitsi_meet: ^4.0.0
Android Studio Bumblebee
Note: Example compilable with XCode 12.2
then -->
Add this line in Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
end
I've ran into the same problem. I tried building the application on iOS Simulator and it keeps getting swift compile errors of all sorts. I followed Usama solution above and it worked for me.
I'm using
MacBook M1
Xcode 14.2
Flutter 3.7.1
Android Studio 2022.1 Electric Eel

No such module 'module X' on Xcode 12.2 only on Simulator

I have recently updated my Xcode to version 12.2 and my macOS to version 11.0.1 Big Sur . My project will successfully when I select my actual device but when I select a Simulator it starts showing this error
No such module as 'X'
Of course rebuilding and deleting DrivedData and pod install ... not worked.
where is the problem?
it has no issue runnig on my actual device.
Just add this piece of code at the end of your PodFile and you are good to go
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end

Flutter ios build fails in xcode 10.1 with swift_version

I'm building a flutter app. everyting worked just fine. Then I think dart was upgraded and suddenly the build of the app fails with this error:
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 3.0, 4.0, 4.2. This setting can be set in the build settings editor.
I don't see the setting in xcode and not sure what caused this error. Anyone else seen it?
For anyone else looking for the solution. You need to have XCode version higher than 10.0 before you can use Swift 4.2.
Open your podfile and make the following changes
target 'Runner' do
use_frameworks! # <---- // 1st add this right below above line
...
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['SWIFT_VERSION'] = '4.2' # <--- // 2nd add this
end
end
end
After this, in terminal use flutter run. More info

Running framework compiled in Swift 4.0 in Xcode 9.1

I recently updated Xcode from 9.0 to 9.1. My project has an external framework created by a business partner which was compiled in Swift 4.0. When I try and run the project, I get the following error thrown by the import of the external framework:
Module compiled with Swift 4.0 cannot be imported in Swift 4.0.2
I understand this problem because Xcode 9.1 uses Swift 4.0.2, however, I am curious if there is anyway to compile this framework now that the Swift versions are incompatible. I tried changing the Swift Language Version variable in the Build Settings to 4.0 however, this made no change. I also don't see an option for 4.0.2 in this list so I am assuming when selecting 4.0 it defaults to 4.0.2?
Is there anyway I can compile this lib, or do I need to wait for them to release an update which was compiled in 4.0.2?
I've done something like:
In cocoapods separate swift 3.0.2 / 4 / 4.0.2 libraries
swift_32 = [<swift 3.0.2 libs>]
swift4 = [<swift 4 libs>]
swift_42 = [<swift 4.0.2 libs>]
post_install do |installer|
installer.pods_project.targets.each do |target|
swift_version = nil
if swift_32.include?(target.name)
swift_version = '3.2'
end
if swift4.include?(target.name)
swift_version = '4.0'
end
if swift_c42.include?(target.name)
swift_version = '4.0'
end
end
end
May be it will help you

Swift compile errors FileBrowser, swift 2.3

I am trying to debug my beta, which worked really fine before iOS 10, Swift 3. and I don't see the end.
I cannot build it. My app is in Swift 2.3 (Xcode 8)
I have an error with the Library FileBrowser version 0.1.4
I add on Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.3'
end
end
end
But I am still having a compile error with the library FileBrowser
error:
Type of previewItemURL' has different optionality than required by protocol 'QLPreviewItem' PreviewManager.swift
Well the library FileBrowser doesn't support Swift 2.3 only swift 3.
Two choices:
- Change library for browsing file
- Switch all the project to swift 3