5

I am reviewing a code from other developers and I saw some unfamiliar codes. One of the unfamiliar code is this.

identifier <- map["id"]

identifier is a variable inside the struct. Can you please help me what is the use of "<-" symbol? I tried googling it but I can't find the right answer. Thank you!

Alvin John
  • 403
  • 4
  • 14

2 Answers2

7

The <- operator is not part of Swift.

There's nothing in the Swift manual about it.

It is a custom operator defined by a third-party library you're using in your project.

If you do a CMD-click on it, Xcode should open the operator's declaration

Antzi
  • 12,831
  • 7
  • 48
  • 74
Eric Aya
  • 69,473
  • 35
  • 181
  • 253
0

The Developer used ObjectMapper. https://github.com/Hearst-DD/ObjectMapper

That's why. Thank you guys for answering my post here.

Cheers!

Alvin John
  • 403
  • 4
  • 14
  • More specifically, this is where the operator "<-" is declared: https://github.com/Hearst-DD/ObjectMapper/blob/master/ObjectMapper/Core/Operators.swift – Federico Zanetello Aug 03 '16 at 10:02