swift - 如何调用swift函数

标签 swift

我有一个函数:

func chatAttachmentService(chatAttachmentService: QMChatAttachmentService, didChangeLoadingProgress progress: CGFloat, forChatAttachment attachment: QBChatAttachment)

我想在我的文件中调用它:

self.chatAttachmentService(chatAttachmentService, progress, attachment)

我知道这是个疯狂的问题,但 Xcode 在输入函数名称时没有向我显示提示,而且我不知道如何以正确的方式调用它...

最佳答案

例如你可以这样做:

这是示例函数:

func testFunction(chatAttachmentService: String, didChangeLoadingProgress progress: String, forChatAttachment attachment: String) {

    //Your code
}

你可以这样调用它:

testFunction("", didChangeLoadingProgress: "", forChatAttachment: "")

关于swift - 如何调用swift函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37134846/

相关文章:

swift - Xcode:架构选择器中缺少自己的 Swift 包

ios - AWS ios SDK - 弹性转码器作业的 http post 请求

ios - 如何检查图像上传到 Firebase 存储的进度

swift - Swift 3 中的滑动手势

ios - 如何保持 UITableView 单元格处于选中状态

ios - swift 包管理器中的 "warning: no targets to build in package"错误

ios - 一个月中的周末天数

mocking - 在 XCTest 中快速模拟对象的最佳方法是什么?

ios - 由于层次结构,无法显示由 MFMailComposeViewController 创建的页面 - Swift 4

ios - 如何从项目的 collectionView 访问选定的单元格?//项目存储在 firebase