Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I declare a public interface, such as apple does. Another way, hide the implementation

Tags:

swift

init

Just like UILabel class:

class UILabel : UIView, NSCoding {

    var text: String! // default is nil
    var font: UIFont! // default is nil (system font 17 plain)
    var textColor: UIColor! // default is nil (text draws black)
    var shadowColor: UIColor! // default is nil (no shadow)
    var shadowOffset: CGSize // default is CGSizeMake(0, -1) -- a top shadow
....
}

But if I define a class like this, which didn't has init function also. The compiler will warning me. How could I do the same thing as Apple does, to hide the implemention, only declare the interface. Thanks.

like image 734
Huangzy Avatar asked Jun 06 '14 06:06

Huangzy


1 Answers

UILabel is not implemented in Swift.

What you see here is derived from the Objective-C header file for UILabel.

like image 88
Thilo Avatar answered Oct 20 '22 17:10

Thilo