嵌入用户时间线 - Twitterkit / Swift

时间:2015-07-28 21:39:41

标签: xcode swift twitter twitter-fabric

有人可以解释如何使用TwitterKit开始完成设置和iOS / Swift视图控制器来显示单个用户的时间线。关于Fabric的文档很差,并没有解释所有必需的app delegate / view控制器。

2 个答案:

答案 0 :(得分:2)

以下是在应用中显示时间轴所需的主要步骤的一小部分GIF。

Demo

答案 1 :(得分:0)

将Fabric添加到项目https://docs.fabric.io/apple/fabric/overview.html非常简单。

import TwitterKit

Swift 3

    // Create an API client and data source to fetch Tweets for the timeline
    let client = TWTRAPIClient()
    //TODO: Replace with your collection id or a different data source
    let dataSource = TWTRCollectionTimelineDataSource(collectionID: "539487832448843776", apiClient: client)
    // Create the timeline view controller
    let timelineViewControlller = TWTRTimelineViewController(dataSource: dataSource)
    // Create done button to dismiss the view controller
    let button = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(dismissTimeline))
    timelineViewControlller.navigationItem.leftBarButtonItem = button
    // Create a navigation controller to hold the
    let navigationController = UINavigationController(rootViewController: timelineViewControlller)
    showDetailViewController(navigationController, sender: self)