Method: Pod::Podfile::TargetDefinition#set_platform

Defined in:
lib/cocoapods-core/podfile/target_definition.rb

#set_platform(name, target = nil) ⇒ void

This method returns an undefined value.

Sets the platform of the target definition.

Parameters:

  • name (Symbol)

    The name of the platform.

  • target (String) (defaults to: nil)

    The deployment target of the platform.

Raises:

  • When the name of the platform is unsupported.



649
650
651
652
653
654
655
656
657
658
659
660
661
662
# File 'lib/cocoapods-core/podfile/target_definition.rb', line 649

def set_platform(name, target = nil)
  name = :osx if name == :macos
  unless [:ios, :osx, :tvos, :visionos, :watchos].include?(name)
    raise StandardError, "Unsupported platform `#{name}`. Platform " \
      'must be `:ios`, `:osx`, `:macos`, `:tvos`, :visionos, or `:watchos`.'
  end

  if target
    value = { name.to_s => target }
  else
    value = name.to_s
  end
  set_hash_value('platform', value)
end