user3255746 user3255746 - 2 months ago 18
iOS Question

Facebook SDK in Swift

I am trying to integrate Facebook login and more into my app but am having a lot of difficulty because there is not much documentation in Swift. I am trying to use this code:

FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/me"
parameters:@{ @"fields": @"id,name,friends,birthday,gender,first_name,last_name,friendlists,picture",}
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
// Insert your code here
}];


Any idea what this would be in Swift?

Answer
 FBSDKGraphRequest(graphPath: "me",
   parameters: ["fields": "id, name, first_name, last_name, picture.type(large), email, gender"])
    .startWithCompletionHandler({ (connection, result, error) -> Void in

 })
Comments