I am trying to learn how to use Swifter for a macOS/iOS app, however the documentation on the site assumes a lot of knowledge I do not have.
If am building a new app, and I have my Twitter API keys from Twitter, how do I setup the callbackURL
so that a user can tweet from my app? My code currently is very simple:
if (meetingSetup.twitterEnabled == true) {
let twitterMessage = "Appropriate text"
delegate.swifter?.postTweet(status: twitterMessage, success: { status in
print("Twitter message: \(twitterMessage)")
},failure: { error in
print("Twitter message: failed")
})
}
I then have Twitter setup in the AppDelegate as follows:
@nonobjc func application(_ application: NSApplication, didFinishLaunchingWithOptions launchOptions: [AnyHashable: Any]?)-> Bool{
swifter = Swifter(consumerKey: twitterConsumerKey, consumerSecret: twitterConsumerSecret, appOnly: true)
return true
}
However, the code doesn't actually ever post the tweet. Reading online I saw that I need a callbackURL
defined, but I don't see any details on how to define this in my code, so that I can setup it up in my Twitter API configuration.
What is the appropriate way of using Swifter and callbackURLs?