What's the difference between target :TargetName and target “TargetName” in CocoaPods Podfile?

StackOverflow https://stackoverflow.com//questions/22083827

  •  24-12-2019
  •  | 
  •  

Question

Using CocoaPods, what's the difference between

target :TargetName do
    # Some pods...       
end

and

target "TargetName" do
    # Some pods...       
end

The CodoaPods Podfile Syntax Reference shows the first as an example, but the pod init Terminal command creates the latter.

Was it helpful?

Solution

:TargetName denotes a Symbol while "TargetName" or 'TargetName' denotes a String.

In this case, they should be pretty much equivalent. The value you pass to the target is probably being converted to a string internally. However, the semantics of these types are very different. Strings are for storing and manipulating free form text, while symbols are more like keywords, a text version of integer constants.

If you aren't sure which to use, you probably want a string.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top