0

I have a class defined in Swift:

protocol CaptureCheckDelegate {
    func checkImageCaptured(image:UIImage)
}

class CaptureCheckController:UIViewController {
    @IBOutlet weak var imageView: UIImageView!
    @IBOutlet weak var useButton: UIButton!
    @IBOutlet weak var retakeButton: UIButton!
    @IBOutlet weak var cancelButton: UIButton!
    @IBOutlet weak var instructions: UILabel!
    @IBOutlet weak var shutterButton: UIButton!

    var existingImage: UIImage?
    var delegate:CaptureCheckDelegate?
    var captureSession: AVCaptureSession?
    var stillImageOutput: AVCaptureStillImageOutput?
    var previewLayer: AVCaptureVideoPreviewLayer?

    //MARK: - User Actions
    @IBAction func useTapped(sender: AnyObject) {
    }

    @IBAction func retakeTapped(sender: AnyObject) {
    }

    @IBAction func cancelTapped(sender: AnyObject) {
    }

    @IBAction func shutterTapped(sender: AnyObject) {
    }
}

However this is what is showing as the class definition for Objective-C:

SWIFT_CLASS("_TtC11Fundraising22CaptureCheckController")
@interface CaptureCheckController : UIViewController
@property (nonatomic, weak) IBOutlet UIImageView * imageView;
@property (nonatomic, weak) IBOutlet UIButton * useButton;
@property (nonatomic, weak) IBOutlet UIButton * retakeButton;
@property (nonatomic, weak) IBOutlet UIButton * cancelButton;
@property (nonatomic, weak) IBOutlet UILabel * instructions;
@property (nonatomic, weak) IBOutlet UIButton * shutterButton;
@property (nonatomic) UIImage * existingImage;
@property (nonatomic) AVCaptureSession * captureSession;
@property (nonatomic) AVCaptureStillImageOutput * stillImageOutput;
@property (nonatomic) AVCaptureVideoPreviewLayer * previewLayer;
- (IBAction)useTapped:(id)sender;
- (IBAction)retakeTapped:(id)sender;
- (IBAction)cancelTapped:(id)sender;
- (IBAction)shutterTapped:(id)sender;
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil OBJC_DESIGNATED_INITIALIZER;
- (instancetype)init OBJC_DESIGNATED_INITIALIZER;
- (instancetype)initWithCoder:(NSCoder *)aDecoder OBJC_DESIGNATED_INITIALIZER;
@end

Note the missing delegate property. Why is it missing? I tried renaming it, doing a clean, clean build folder, and removing the DerivedData folder. None of these actions make the property appear for Objective-C.

What am I doing wrong? How can I make this property appear?

Xcode 6.1.1 production.

Aaron Bratcher
  • 6,051
  • 2
  • 39
  • 70
  • Your question was about `var delegate:CaptureCheckDelegate?` and `CaptureCheckDelegate` is a protocol, isn't it? So it is the same situation as in the linked question. Does `@objc protocol CaptureCheckDelegate { ... } ` solve the problem? – If not then I apologize and reopen the question immediately. – Martin R Mar 09 '15 at 14:30
  • Ah, I apologize. it didn't occur to me the issue was the protocol wasn't visible. Because of that, I wouldn't have typed in your search terms as you so quickly did. So many people so quick to dismiss questions on here these days. – Aaron Bratcher Mar 09 '15 at 14:32
  • I have deleted my initial comment, it was not constructive. – Martin R Mar 09 '15 at 15:10

0 Answers0