Well, you simply call the function at the end of the asynchronous callback. That is when the asynchronous callback has ended - it is when everything else in the asynchronous callback has finished! So, for example:
func myMethod() {
// ... code ...
somebody.doSomethingWith(someObject, asynchronousCallback: {
(thing, otherThing) in
// ... do whatever
// --> CALL THE FUNCTION!
})
// ... code ...
}
If the problem is that you do not know what function to call, you can configure your surrounding function / object so that someone can hand you a function which is then what you call in the spot where I said "call the function" in the above.
For example:
func myMethod(f:() -> ()) { // we receive the function as parameter
// ... code ...
somebody.doSomethingWith(someObject, asynchronousCallback: {
(thing, otherThing) in
// ... do whatever
// --> CALL THE FUNCTION, by saying:
f()
})
// ... code ...
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…