How can I retrieve Swift “header” files for Cocoa APIs?

后端 未结 3 1551
后悔当初
后悔当初 2020-12-13 03:02

The way I know I can view the automatically-translated Swift versions of Cocoa APIs is by command-clicking a Cocoa type in Xcode. For example, here\'s what is generated for

3条回答
  •  抹茶落季
    2020-12-13 03:21

    It turns out the modern (non-"deprecated") REPL has a way of doing this too. Rather than :print_module, you can use :type lookup:

    echo -e "import CoreGraphics\n:type lookup CoreGraphics" | swift
    

提交回复
热议问题