I am trying to find my UILabels in my overview of my UIViewControllers. This is my code:
func watch(startTime:String, endTime:String) { if superview == nil {println("NightWatcher: No viewcontroller specified");return} listSubviewsOfView(self.superview!) } func listSubviewsOfView(view: UIView) { var subviews = view.subviews if (subviews.count == 0) { return } view.backgroundColor = UIColor.blackColor() for subview in subviews { if subview.isKindOfClass(UILabel) {
This is how it is recommended in Objective-C, but in Swift I get nothing but UIViews and CALayer. I definitely have UILabels in the view that is provided to this method. What am I missing?
Calling my UIViewController:
NightWatcher(view: self.view).watch("21:00", endTime: "08:30")
source share