How to integrate tweets in your app ? [Swift]


#1

Hello,

I am a young developer (14 - but I still know some of Swift:] ) and I would like to know if someone could share how to integrate a timeline of tweets in an app.
If you have solutions ou suggestions, I would really appreciate.
I would like to use Fabric because it looks like it is fantastic but if you have another suggestion I’ll take it.

Kind regards,

P.S. : I know it is not really a good way to ask but I’ve looked on many websites and didn’t find nothing. Thanks for understanding :]


#2

Hey there,

Awesome question and with Fabric we wanted to make it very easy for developers to show Tweets or Timelines within their app. Check out how to add a timeline to your app here.

-Mike


#3

Hello,

Thanks for your answers.

It seems not to work in my app… It tells me after I declared “import Fabric”, when I add TWTRTimelineViewController that this method doesn’t exist.
Also the example in your link seems not to work too. The one under “Here’s an example on setting up a User Timeline with TWTRTimelineViewController and TWTRUserTimelineDataSource”

What is the problem ? Have I done something wrong ?

Kindest regards,


#4

Thanks for letting me know - can you include some sample code from your app where the timeline isn’t working?


#5

The code is from your link.
Here is the code

// UserTimelineViewController.swift
import UIKit
import TwitterKit
 
class UserTimelineViewController: TWTRTimelineViewController {
  convenience init() {
      let client = Twitter.sharedInstance().APIClient
      let dataSource = TWTRUserTimelineDataSource(screenName: "fabric", APIClient: client)
 
      self.init(dataSource: dataSource)
  }
 
  override required init(dataSource: TWTRTimelineDataSource) {
      super.init(dataSource: dataSource)
  }
 
  required init(coder aDecoder: NSCoder) {
      fatalError("init(coder:) has not been implemented")
  }
}

And I have an error under TWTRTimelineViewController and the error is Use of undeclared type "TWTRTimelineViewController"

Also under TWTRUserTimelineDataSource(screenName: "fabric", APIClient: client) and the error is Use of unresolved identifier "TWTRUserTimelineDataSource"

And under required init(dataSource: TWTRTimelineDataSource)
I have a "Use of undeclared type "TWTRTimelineDataSource"

Here is a screenshot,

Thank you in advance for your help.


#6