Reputation: 126327
What is the difference between import ObjectiveC
& import Foundation
in Swift?
Upvotes: 2
Views: 137
Reputation: 126327
Foundation is more inclusive than ObjectiveC. I'm not sure, however, if Foundation is a superset (if you will) of ObjectiveC. I.e., ObjectiveC might include things not included by Foundation.
Anyway, if, e.g., you're just subclassing from NSObject
, you can just import ObjectiveC.NSObject
instead of import Foundation.NSObject
, which also works but includes more than needed.
If, however, e.g., you're declaring a property of type NSDate
, import ObjectiveC.NSDate
doesn't work, so you'll have to import Foundation.NSDate
.
Upvotes: 2