Request
public class Request : NSObject
A class to query Twitter.
Usage:
Create an instance of it.
Call fetchTweets. The handler passed to that method will be called when the information comes back from Twitter.
Once a successful fetch has happened, a follow-on TwitterRequest to get more Tweets (newer or older) can be created using the newer/older properties.
You will only need to use those public properties and methods.
-
Initializer for creating a Request that is a search for Tweets
Declaration
Swift
public convenience init(search: String, count: Int = 0)
Parameters
search
The text to search for.
count
Optional number of tweets to ask for.
-
Fetch a bunch of tweets from Twitter. When the request completes, the provided handler is called with the array of fetched Tweets.
Note
The handler passed to this method is not guaranteed to run on the main UI thread.
Declaration
Swift
public func fetchTweets(_ handler: @escaping (_ tweets: [Tweet]) -> Void)
Parameters
handler
The method to run when the request completes.
tweets
The tweets gotten for this request.
-
Generates a request for older Tweets than were returned by self. This only makes sense if self has completed a fetch already.
Declaration
Swift
public var older: Request? { get }
-
Generates a request for newer Tweets than were returned by self. This only makes sense if self has completed a fetch already.
Declaration
Swift
public var newer: Request? { get }