ChimpKit3 icon indicating copy to clipboard operation
ChimpKit3 copied to clipboard

Swift subscription with completion block

Open webmagnets opened this issue 10 years ago • 2 comments

Can you please provide a sample for subscribing an email address with a block in Swift?

webmagnets avatar Jun 26 '15 10:06 webmagnets

I'm also looking for a swift sample

fabreax avatar Jan 18 '16 09:01 fabreax

This is a functional sample :

ChimpKit.sharedKit().apiKey = "your api key"
let params:[NSObject : AnyObject] = ["id": "your list id", "email": ["email": "[email protected]"]]
ChimpKit.sharedKit().callApiMethod("lists/subscribe", withParams: params, andCompletionHandler: {(response, data, error) -> Void in
            if let httpResponse = response as? NSHTTPURLResponse {
                NSLog("Reponse status code: %d", httpResponse.statusCode)
            }
})

fabreax avatar Jan 18 '16 16:01 fabreax