Swift weakSelf写法

类:AVC

#import


typedef void(^ABlock)(void);


@interface AVC : UIViewController


@property (nonatomic,copy) ABlock aBlock;


@end




引用类:

    @IBAction func btnClick(sender: AnyObject) {

        let vc:AVC = AVC()

        vc.aBlock = ({[weak self] in

            let vc0:AVC = AVC()

            self!.navigationController?.pushViewController(vc0, animated: true)

        })

        self.navigationController?.pushViewController(vc, animated: true)

    }

你可能感兴趣的:(iOS)