【发布时间】:2021-07-03 13:33:25
【问题描述】:
所以我定义了一个 objc 方法:
@objc func networkCall(action: NetworkAction) { //Error: Method cannot be marked @objc because the type of the parameter cannot be represented in Objective-C
switch action {
case .post:
print("Posting")
case .get:
print("Getting")
case .delete:
print("Deleting")
case .update:
print("Updating")
}
}
我想在这里打电话:
postButton.addTarget(self, action: #selector(networkCall(action: .post)), for: .touchUpInside) //Error: Argument of '#selector' does not refer to an '@objc' method, property, or initializer
是否可以将枚举作为参数传递给 objc?
【问题讨论】:
标签: swift