Reputation: 456
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.
Upvotes: 6
Views: 2817
Reputation: 385950
Open your Swift source file. Find the import UIKit
line. Command-click on the word UIKit
. You'll see what UIKit
imports:
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:
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.
Upvotes: 15