什么与UIKit导入,我如何找到?

时间:2021-12-10 15:09:25

When using Objective-C and importing headers, it made sense to me what was getting imported. For example, I only have to import UIKit but I can use CoreGraphics, for example. How can I tell what other frameworks each framework is importing with Swift? All I'm doing is importing UIKit, but I can still use Core Graphics. I've searched the documentation, but the framework reference doesn't mention it.

使用Objective-C并导入标题时,对我来说导入的内容是有意义的。例如,我只需要导入UIKit,但我可以使用CoreGraphics。如何判断每个框架使用Swift导入的其他框架?我正在做的就是导入UIKit,但我仍然可以使用Core Graphics。我搜索了文档,但框架参考没有提到它。

2 个解决方案

#1


7  

Open your Swift source file. Find the import UIKit line. Command-click on the word UIKit. You'll see what UIKit imports:

打开Swift源文件。找到导入UIKit线。按住Command键并单击UIKit。你会看到UIKit导入的内容:

import Foundation
import UIKit.NSAttributedString
import UIKit.NSFileProviderExtension
import UIKit.NSLayoutConstraint
import UIKit.NSLayoutManager
import UIKit.NSParagraphStyle
import UIKit.NSShadow
import UIKit.NSStringDrawing
import UIKit.NSText
import UIKit.NSTextAttachment
import UIKit.NSTextContainer
... many more

Command-click on the word Foundation on the first line to see what it imports:

按住Command键并单击第一行上的单词Foundation,查看它导入的内容:

import CoreFoundation
import CoreGraphics
import Foundation.FoundationErrors
import Foundation.NSArray
import Foundation.NSAttributedString
import Foundation.NSAutoreleasePool
import Foundation.NSBundle
import Foundation.NSByteCountFormatter
import Foundation.NSByteOrder
... many more

Repeat until bored or satisfied.

重复直到无聊或满意为止。

#2


0  

Refer to the documentation on Swift.

请参阅Swift上的文档。

什么与UIKit导入,我如何找到?

#1


7  

Open your Swift source file. Find the import UIKit line. Command-click on the word UIKit. You'll see what UIKit imports:

打开Swift源文件。找到导入UIKit线。按住Command键并单击UIKit。你会看到UIKit导入的内容:

import Foundation
import UIKit.NSAttributedString
import UIKit.NSFileProviderExtension
import UIKit.NSLayoutConstraint
import UIKit.NSLayoutManager
import UIKit.NSParagraphStyle
import UIKit.NSShadow
import UIKit.NSStringDrawing
import UIKit.NSText
import UIKit.NSTextAttachment
import UIKit.NSTextContainer
... many more

Command-click on the word Foundation on the first line to see what it imports:

按住Command键并单击第一行上的单词Foundation,查看它导入的内容:

import CoreFoundation
import CoreGraphics
import Foundation.FoundationErrors
import Foundation.NSArray
import Foundation.NSAttributedString
import Foundation.NSAutoreleasePool
import Foundation.NSBundle
import Foundation.NSByteCountFormatter
import Foundation.NSByteOrder
... many more

Repeat until bored or satisfied.

重复直到无聊或满意为止。

#2


0  

Refer to the documentation on Swift.

请参阅Swift上的文档。

什么与UIKit导入,我如何找到?