title: Returning a Promise from PromiseKit/Alamofire
body: <p>I'm trying to do this seemingly trivial thing:</p>
  
  <pre><code>static func list() -&gt; Promise&lt;[Activity]&gt; {
      let endpoint = "\(self.baseUrl)/v1/activities"
  
      return Promise { fulfill, reject in
          self.fetchHeaders { (headers) in
              return Alamofire.request(
                  endpoint,
                  method: .get,
                  parameters: nil,
                  encoding: JSONEncoding.default,
                  headers: headers
              ).validate().responseJSON().then() { response in
                  guard let json = response as? JSON else {
                      reject(ActivityError.parse("Malformed JSON"))
                  }
  
                  guard let jsonActivities = json["activities"] as? [JSON] else {
                      reject(ActivityError.parse("Missing field"))
                  }
  
                  var activities: [Activity] = []
  
                  for jsonActivity in jsonActivities {
                      guard let activity = Activity(json: jsonActivity) else {
                          reject(ActivityError.parse("Unable to parse an Activity object"))
                      }
  
                      activities.append(activity)
                  }
  
                  fulfill(activities)
              }.catch { error in
                  reject(ActivityError.network("HTTP response failure"))
              }
          }
      }
  }
  </code></pre>
  
  <p>However, the compiler (rightfully) complains that:</p>
  
  <blockquote>
    <p>'guard' body may not fall through, consider using 'return' or 'break'
    to exit the scope</p>
  </blockquote>
  
  <p>I understand I need to <em>return</em> a Promise here. I just can't figure out what exactly to put below the reject() and fulfill() calls.</p>