1

Everytime i'd like to do some research how a problem is solved in swift standard libraries, Xcode shows only the corresponding header file of the specific class.

For Example when i want to see how the M_PI_2 property or the String class is implemented with cmd + click, Xcode shows only the "header" of this computed property / class, but not the actual underlying source code.

Is there any possible way to attach Swifts source code to Xcode like you can add the Java sources in eclipse like its done here?

  • How can i add the Swift 3 source files?
  • How can i force Xcode to show them instand of the header files?
Community
  • 1
  • 1
history
  • 11
  • 3
  • You're not going to see those sorts of things in Xcode. You have to actually go to the source on GitHub. For example, see [`String`](https://github.com/apple/swift/blob/3f534c254df2b90d176b7daea3cd7a6a9cfbfa5e/stdlib/public/core/String.swift). As an aside, in Swift 3, we don't use `M_PI_2` anymore. We generally use `Float.pi`, `Double.pi`, etc. See [`FloatingPointTypes.swift`](https://github.com/apple/swift/blob/5fd8d0f05c95ad60102bb3945201e962b50e2b3a/stdlib/public/core/FloatingPointTypes.swift.gyb). – Rob Nov 04 '16 at 22:03
  • Thanks Rob. Isn't there any more comfortable way? Is it even possible to attach any sources to a project in Xcode? – history Nov 04 '16 at 22:04
  • Yes, I understand the question. AFAIK, you can't get there from Xcode itself, while you're working on your own code, which is why I go to that GitHub repo. But maybe someone else knows of some clever way to achieve what you want... – Rob Nov 04 '16 at 22:06

0 Answers0