【发布时间】:2016-07-07 14:33:50
【问题描述】:
我有一个类型别名,我想在将其中一个对象作为一个完成处理程序接收之后并在将其发送给另一个之前对其进行操作。所以
typealias GalleryResponse = (gallery: MLGallery?, error: NSError?) -> ()
以及我想干预 typealias 的函数:
func getGalleryForDiscover(onCompletion: galleryResponse) {
let endpointURL = kGalleryURL + kMetaDataFilter + kLimitURL20
/// Would like to do something here with the MLGallery object in the galleryResponse closure.
makeRequestToCurbsAt(endpointURL, completionHandler: onCompletion)
}
我如何获得 MLGallery 对象 - 对其进行操作 - 然后将其发送出去?
【问题讨论】:
-
你的问题真的很模糊。尝试提供有关 MLGallery 的更多详细信息
-
typealias 表示确切的类型别名。在您的情况下,galeryResponse 是具有签名的函数的别名(图库:MLGallery?,错误:NSError?)->()。不多,不多....
-
您在您传递给 getGalleryForDiscover 函数的 galleryResponse 闭包中操作 galleryResponse 中的图库
标签: swift type-alias