Skip to content

Instantly share code, notes, and snippets.

@macteo
Last active May 22, 2018 16:44
Show Gist options
  • Save macteo/d36f8884e39838d11a321996098a53c4 to your computer and use it in GitHub Desktop.
Save macteo/d36f8884e39838d11a321996098a53c4 to your computer and use it in GitHub Desktop.

Revisions

  1. macteo revised this gist May 22, 2018. 1 changed file with 4 additions and 11 deletions.
    15 changes: 4 additions & 11 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,4 @@
    public func lookup(emailAddress: String, completion: (_ contact: Contact?) -> Void) {
    /*
    Here we are searching through a local array of contacts. This could
    instead be an asynchronous call to a remote server.
    */
    for contact in contacts where contact.emailAddress == emailAddress {
    completion(contact)
    }

    completion(nil)
    }
    for contact in contacts where contact.emailAddress == emailAddress {
    completion(contact)
    }
    completion(nil)
  2. macteo created this gist May 22, 2018.
    11 changes: 11 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    public func lookup(emailAddress: String, completion: (_ contact: Contact?) -> Void) {
    /*
    Here we are searching through a local array of contacts. This could
    instead be an asynchronous call to a remote server.
    */
    for contact in contacts where contact.emailAddress == emailAddress {
    completion(contact)
    }

    completion(nil)
    }