Uploaded image for project: 'Swift Driver'
  1. Swift Driver
  2. SWIFT-369

Stitch Functions: mongodb.com documentation inconsistent with GitHub

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None

      Description

      On this Call a Function page, the iOS SDK example given is: 

      let client = Stitch.defaultAppClient!
      client.callFunction(withName: "sum", withArgs: [3, 4]) { result in
          print(result) // Output: 7
      }
      

      This will not actually print 7, but instead:

      A correct example, listed on Github, is:

      let client = Stitch.defaultAppClient!
       
      print("logging in anonymously")
      client.auth.login(withCredential: AnonymousCredential()) { result in
              switch result {
              case .success(let user):
                  print("logged in anonymous as user \(user.id)")
                  DispatchQueue.main.async {
                      // update UI accordingly
                  }
              case .failure(let error):
                  print("Failed to log in: \(error)")
              }
          }
      

        Attachments

          Activity

            People

            Assignee:
            matt.broadstone Matt Broadstone
            Reporter:
            rob@challe.co Rob Dearborn
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: