Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typealias CompletionResponse = ((_ response: AnyObject) -> Void)?
- class SomeClass {
- static let shared = SomeClass()
- var completion: CompletionResponse?
- func getSomthing(completion: CompletionResponse) {
- self.completion = completion
- }
- func someDelegateMethode(info: [String]) {
- // Error is here
- if let completion = self.completion {
- completion(info)
- }
- }
- }
- let x = SomeClass()
- x.getSomthing { (obj) in
- print(obj as! [String])
- }
- x.someDelegateMethode(info: ["Hello", "There"])
Add Comment
Please, Sign In to add comment