我想將我的Objective C源代碼轉換爲swift,我已經搜索了很多塊來更改語法。如何在iOS中使用Swift聲明塊?
這裏是我想切換到斯威夫特我的目標C代碼:
class.h文件:
@property (nonatomic, copy) void (^tapBlock)(CGFlagsCell *);
+ (NSString *)cellIdentifier;
Class.m文件:
self.tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapCell)];
- (void)didTapCell {
self.tapBlock(self);
}
我已將類方法轉換爲類func cellIdentifier() - > String { return「yourValue」 }請其他人幫助我。謝謝! –
我沒有得到你想要的東西。 – BoilingLime
@ BoilingLime我想將我的上述目標C代碼轉換爲Swift for Blocks。我的Objective C代碼是:@property(nonatomic,copy)void(^ tapBlock)(CGFlagsCell *); –