简体   繁体   English

Swift转义块声明

[英]Swift escaping block declaration

I have the following code: 我有以下代码:

typealias queryCompletionBlock = (_ finished:Bool) -> Void

func queryForParams(@escaping completion:queryCompletionBlock)

But I get an error 但我得到一个错误

Attribute can only be applied to types, not declarations

The problem is the function requires block to be escaping. 问题在于该函数需要转义该块。 How do I declare the above function with an escaping block? 如何用转义块声明上述功能?

func queryForParams(completion: @escaping queryCompletionBlock)

试试func queryForParams(completion: @escaping queryCompletionBlock)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM