Reputation: 2021
I have a custom frame work and it contains some public class.But i cannot able to use that public class. In objective C we can import as
#import <XYZ/XYZCustomCell.h>
but how is it possible in swift
Upvotes: 6
Views: 4182
Reputation: 11
It works also for classes, but the class that you try to import should be public :
public class DeviceHelper: NSObject {
}
And to use it, you just have to do :
import class DeviceHelper.DeviceHelper
with DeviceHelper that is a cocoa touch custom framework included in my project.
Upvotes: 1
Reputation: 919
You import a module using the "import" keyword, it works the following way:
import XYZ
If you want to import a struct/function/enum only, you can do this:
import struct XYZ.SomeStruct
import func XYZ.someFunc
That syntax fits for typealias, struct, class, enum, protocol, var, or func.
Upvotes: 8