7

I am working on a project with mixed Objective-C and Swift; I followed the "Using Swift with Cocoa and Objective-C" guide by Apple and it works great.

Out of curiosity, I would like to locate and read the generated header described in the "Mix and Match" chapter :

Objective-C and Swift Mix and Match

But I can not find it anywhere in Xcode

Axel Guilmin
  • 11,454
  • 9
  • 54
  • 64

2 Answers2

6

Using Finder, after a successful build in Xcode 10, the generated header can be found deep in the derived data :

~/Library/Developer/Xcode/DerivedData/ ProductModuleName-foo/ Build/ Intermediates.noindex/ ProductModuleName.build/ Debug-iphoneos/ ProductModuleName.build/ DerivedSources/ ProductModuleName-Swift.h

Where ProductModuleName is the PRODUCT_MODULE_NAME of your target and foo a seemingly random string.

Axel Guilmin
  • 11,454
  • 9
  • 54
  • 64
5

Finding the editing file

If you want to find the header file in your project, press..

cmd + shift + 0

when the search bar pops up, search for your file name

MyProject-swift.h

on the file press

cmd + shift + j

then right click and tap reveal in finder

Finding the generated file

1) Go to any objective c class where you import Myproject-swift.h

2) Then press cmd on "#import Myproject-swift.h" on top of the file

3) Click "jump to definition"

3) And there it is!

Let me know if that solves your problem!

cevalloa
  • 132
  • 4