I have created an method with an closure that is used to fetch data by an AJax request, parse it and convert it to an struct:
static func getAllByCategory(category : String, completion : @escaping ([MenuItem]) -> Void) -> Void {
The category is needed to define from which category the menu items needs to be fetched.
The implementation is according Swift ok. But when i tried to call this method, Swift gives an strange error: 'Editor placeholder in source file'
when adding the category in this call:
MenuData.getAllByCategory(category: self.selectedCategory) { (menuItem) in
}
In the documentation Swift gives an example that looks exactly the same. What did i do wrong?
Thanks!
I did something stupid. Compiler gives error on an automatic piece called code
. Error popup shows up on parameter but is caused in content. Problem solved.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.