如何调用swift函数
我有一个功能:如何调用swift函数,swift,Swift,我有一个功能: func chatAttachmentService(chatAttachmentService: QMChatAttachmentService, didChangeLoadingProgress progress: CGFloat, forChatAttachment attachment: QBChatAttachment) func testFunction(chatAttachmentService: String, didChangeLoadingProgress
func chatAttachmentService(chatAttachmentService: QMChatAttachmentService, didChangeLoadingProgress progress: CGFloat, forChatAttachment attachment: QBChatAttachment)
func testFunction(chatAttachmentService: String, didChangeLoadingProgress progress: String, forChatAttachment attachment: String) {
//Your code
}
我想在我的文件中调用它:
self.chatAttachmentService(chatAttachmentService, progress, attachment)
我知道这是个疯狂的问题,但Xcode在键入函数名时并没有给我提示,我不知道如何正确调用它…例如,您可以这样做:
testFunction("", didChangeLoadingProgress: "", forChatAttachment: "")
以下是示例函数:
func chatAttachmentService(chatAttachmentService: QMChatAttachmentService, didChangeLoadingProgress progress: CGFloat, forChatAttachment attachment: QBChatAttachment)
func testFunction(chatAttachmentService: String, didChangeLoadingProgress progress: String, forChatAttachment attachment: String) {
//Your code
}
你可以这样称呼它:
testFunction("", didChangeLoadingProgress: "", forChatAttachment: "")
例如,您可以这样做:
testFunction("", didChangeLoadingProgress: "", forChatAttachment: "")
以下是示例函数:
func chatAttachmentService(chatAttachmentService: QMChatAttachmentService, didChangeLoadingProgress progress: CGFloat, forChatAttachment attachment: QBChatAttachment)
func testFunction(chatAttachmentService: String, didChangeLoadingProgress progress: String, forChatAttachment attachment: String) {
//Your code
}
你可以这样称呼它:
testFunction("", didChangeLoadingProgress: "", forChatAttachment: "")
你是说Xcode智能不起作用?然后退出Xcode并重新启动它。尝试重新启动Xcode并清理生成文件夹。尽管请注意,调用函数时会忽略第一个参数名,除非它有显式的外部参数名。@JigarTarsariya是的,你是说Xcode智能无法工作?然后退出Xcode并重新启动它。尝试重新启动Xcode并清理生成文件夹。尽管请注意,调用函数时会忽略第一个参数名,除非它有显式的外部参数名。@JigarTarsariya是的