-1

I'm trying to setup an outlet collection in swift. The problem is I am getting the following error :

'IBOutlet' property cannot be an array of non-'@objc' class type '[Badge]'

Here is my code :

import UIKit

class BadgeModuleCell: UITableViewCell
{
    @IBOutlet var badges: [Badge]!
}

Is there anything I am doing wrong ? This seems to be the same as in the Apple documentation (here).

Aeradriel
  • 1,224
  • 14
  • 36
  • 1
    Can you post the definition of `Badge`? It looks like `Badge` is a struct, not a class. – kubi Jun 18 '15 at 21:58
  • Urg, my bad, you made me find it ! I had a custom view called Badge, that I renamed to BadgeView to define a class from scratch called Badge... Thanks ! – Aeradriel Jun 18 '15 at 22:02

1 Answers1

0

I figured out what was going wrong. I initially had a class called "Badge" that was a custom UIView. All was fine. Then I renamed it into "BadgeView" to allow me declare a new class called "Badge" from scratched. So here my outlet collection was supposed to contain object that are not outlet, which has no sense. I renamed @IBOutlet var badges: [Badge]! to @IBOutlet var badges: [BadgeView]! and all is working now.

Aeradriel
  • 1,224
  • 14
  • 36