I am trying to use Algolia for iOS. SWIFT_VERSION is not found for the Pod and throwing an error
Disclaimer, Algolia put out a podsec that does include the SWIFT_VERSION so I am able to proceed forward but wanted to know for the future if I run into the following error again
For the old pod, I followed the instructions here
https://cocoapods.org/pods/InstantSearchClient
I received this error Unable to determine swift version for the following pods:
‘InstantSearchClient-library’ does not specify a Swift version and none of the targets ( ‘Pods’ ) integrating it have the ‘SWIFT_VERSION’ attribute set. Please contact the author or set the ‘SWIFT_VERSION’ attribute in at least one of the targets that inegrate this pod
StackOverflow had the following suggestions which did not work for me
use a pre_install error: SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'Starscream')
set the ENV['SWIFT_VERSION'] = '5' at the top of the Podfile 'Unable to determine Swift version for the following pod" - Error
Set the SWIFT_VERSION in code ( I received an error message that the variable SWIFT_VERSION ) was already in use
Here is my code:
ENV['SWIFT_VERSION'] = '5'
platform :ios, '9.0'
pod 'InstantSearchClient', '~> 7.0'
target 'contacts' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
project 'contacts'
# Pods for contacts
target 'contactsTests' do
inherit! :search_paths
# Pods for testing
end
target 'contactsUITests' do
# Pods for testing
end
pre_install do |installer|
installer.analysis_result.specifications.each do |s|
if s.name == 'InstantSearchClient'
s.swift_version = '5.0'
end
end
end
end