Guest User

Untitled

a guest
Jan 18th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. typealias CompletionResponse = ((_ response: AnyObject) -> Void)?
  2.  
  3. class SomeClass {
  4.  
  5. static let shared = SomeClass()
  6.  
  7. var completion: CompletionResponse?
  8.  
  9. func getSomthing(completion: CompletionResponse) {
  10. self.completion = completion
  11. }
  12.  
  13. func someDelegateMethode(info: [String]) {
  14. // Error is here
  15. if let completion = self.completion {
  16. completion(info)
  17. }
  18. }
  19. }
  20.  
  21. let x = SomeClass()
  22.  
  23. x.getSomthing { (obj) in
  24. print(obj as! [String])
  25. }
  26.  
  27. x.someDelegateMethode(info: ["Hello", "There"])
Add Comment
Please, Sign In to add comment