I'm using RedditKit to integrate Reddit into an app, and in Objective-C I called the API as follows (and it worked fine):
[[RKClient sharedClient] signInWithUsername:@"username" password:@"password" completion:^(NSError *error) {
RKPagination *pagination = [RKPagination paginationWithLimit:100];
[[RKClient sharedClient] linksInSubredditWithName:subredditSelected pagination:pagination completion:^(NSArray *collection, RKPagination *pagination, NSError *error) {
// code that executes on completion
}];
}];
Here's how I'm calling it in Swift:
RKClient.sharedClient().signInWithUsername("username", password: "password", completion: { (error: NSError!) in
RKClient.sharedClient().frontPageLinksWithPagination(RKPagination(limit: 50), completion: { (collection: RKLink[]!, pagination: RKPagination!, error: NSError!) in
// code that executes on completion
})
})
But I keep getting this error with the Swift version:
Could not find an overload for 'init' that accepts the supplied arguments
EDIT: Here's an example project showing it: http://cl.ly/3K0i2P1r3j1y