Method: Pod::Specification::DSL::RootAttributesAccessors#swift_versions

Defined in:
lib/cocoapods-core/specification/root_attribute_accessors.rb

#swift_versionsArray<Version>

Returns The Swift versions supported by the specification.

Returns:

  • (Array<Version>)

    The Swift versions supported by the specification.



48
49
50
51
52
53
54
55
56
57
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 48

def swift_versions
  @swift_versions ||= begin
    swift_versions = Array(attributes_hash['swift_versions']).dup
    # Pre 1.7.0, the DSL was singularized as it supported only a single version of Swift. In 1.7.0 the DSL
    # is now pluralized always and a specification can support multiple versions of Swift. This ensures
    # we parse the old JSON serialized format and include it as part of the Swift versions supported.
    swift_versions << attributes_hash['swift_version'] unless attributes_hash['swift_version'].nil?
    swift_versions.map { |swift_version| Version.new(swift_version) }.uniq.sort
  end
end