Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Modelo {
- func getData(completion: ((_ data: String) -> Void)) {
- let datos = "Datos de la Red!"
- completion(data)
- }
- }
- class ViewController: UIViewController {
- let modelo = Model()
- override func viewDidLoad() {
- super.viewDidLoad()
- model.getData { [weak self] (data: String) in
- self?.updateView(data)
- }
- }
- private func updateView(_ data: String) {
- print(data)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement