{"id":1904,"url":"https://github.com/mattdonnelly/Swifter","last_synced_at":"2025-08-06T12:32:04.090Z","repository":{"id":17761900,"uuid":"20619775","full_name":"mattdonnelly/Swifter","owner":"mattdonnelly","description":"[DEPRECATED] :bird: A Twitter framework for iOS \u0026 OS X written in Swift","archived":false,"fork":false,"pushed_at":"2022-06-23T10:03:20.000Z","size":1420,"stargazers_count":2374,"open_issues_count":42,"forks_count":388,"subscribers_count":75,"default_branch":"master","last_synced_at":"2024-11-28T12:38:27.150Z","etag":null,"topics":["deprecated"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattdonnelly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-08T15:35:34.000Z","updated_at":"2024-09-10T01:15:26.000Z","dependencies_parsed_at":"2022-08-19T17:01:11.136Z","dependency_job_id":null,"html_url":"https://github.com/mattdonnelly/Swifter","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattdonnelly%2FSwifter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattdonnelly%2FSwifter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattdonnelly%2FSwifter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattdonnelly%2FSwifter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattdonnelly","download_url":"https://codeload.github.com/mattdonnelly/Swifter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228898287,"owners_count":17988652,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deprecated"],"created_at":"2024-01-05T20:15:58.626Z","updated_at":"2024-12-09T13:30:36.060Z","avatar_url":"https://github.com/mattdonnelly.png","language":"Swift","funding_links":[],"categories":["SDK","Libs","Swift","语言篇","Third Party APIs","Networking","API [🔝](#readme)","etc"],"sub_categories":["Unofficial","API","Swift","Other free courses"],"readme":"# ⚠️ This project has been deprecated: https://github.com/mattdonnelly/Swifter/issues/360  ⚠️\n\n***\n\n\u003cp align=\"center\" \u003e\n  \u003cimg src=\"swifter_logo.png\" alt=\"Swifter\" title=\"Swifter\" width=\"563\"\u003e\n\u003c/p\u003e\n\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n## Getting Started\n\n### Installation\n\nIf you're using Xcode 6 and above, Swifter can be installed by simply dragging the Swifter Xcode project into your own project and adding either the SwifteriOS or SwifterMac framework as an embedded framework.\n\n### Usage\n\nSwifter can be used with the 3 different kinds of authentication protocols Twitter allows. You can specify which protocol to use as shown below. For more information on each of the authentication protocols, please check [Twitter OAuth Help](https://dev.twitter.com/oauth).\n\nInstantiation with ACAccount:\n\n```swift\n\n// Instantiation using ACAccount\nvar swifter = Swifter(account: twitterAccount)\n\n// Instantiation using Twitter's OAuth Consumer Key and secret\nswifter = Swifter(consumerKey: TWITTER_CONSUMER_KEY, consumerSecret: TWITTER_CONSUMER_SECRET)\n\n// Instantiation using App-Only authentication\nswifter = Swifter(consumerKey: TWITTER_CONSUMER_KEY, consumerSecret: TWITTER_CONSUMER_SECRET, appOnly: true)\n\n```\n\n## Example Requests\n\n#### OAuth Authorization:\n\n```swift\nswifter.authorize(with: callbackURL, success: { accessToken, response in\n  // ...\n}, failure: { error in\n  // ...\n})\n```\n\n#### Get Home Timeline:\n\n```swift\nswifter.getHomeTimeline(count: 50, success: { json in\n  // ...\n}, failure: { error in\n  // ...\n})\n```\n\n#### ListTag, UserTag, and UsersTag\nCertain  Twitter API calls allows you to use either the `user_id` or `screen_name` to get user related objects (and `list_id`/`slug` for lists). Swifter offers a solution so that the user won't accidentally use the wrong method, and have nothing returned. For more information, check the `SwifterTag.swift` file.\n\n```swift\nswifter.getUserFollowersIDs(for: .id(userId), success: { json, prev, next in\n    // alternatively, you can use .screenName(userName)\n    // ...\n}, failure: { error in\n    // ...\n})\n\n```\n\n```swift\n\nswifter.getListSubscribers(for: .slug(listSlug, owner: .screenName(userName)), success: { json, prev, next in\n    // alternatively, you can use .id(listId)\n    // ...\n}, failure: { error in\n    // ...\n})\n\n```\nAdditionally, there is also `.screenName(arrayOfUserNames)` and `.id(arrayOfIds)` for methods that take arrays of screen names, or userIDs\n\n#### Streaming API:\n\n**Important Note**: Twitter has deprecated the Streaming API in favour of their new [Accounts Activity API](https://developer.twitter.com/en/docs/accounts-and-users/subscribe-account-activity/api-reference/aaa-enterprise). You can find out more about migrating to the new API [here](https://developer.twitter.com/en/docs/accounts-and-users/subscribe-account-activity/migration/us-ss-migration-guide). Twitter plans to remove the old streaming API on August 16, 2018, Swifter will remove the endpoints for it shortly after that. \n\n```swift\nswifter.streamRandomSampleTweets(progress: { status in\n  // ...\n}, stallWarnings: { code, message, percentFull in\n  // ...\n}, failure: { error in\n  // ...\n})\n```\n\n#### Status Update:\n\n```swift\nswifter.postTweet(status: \"Hello, world.\", success: { status in\n  // ...\n}, failure: { error in\n  // ...\n})\n```\n\n## JSON Handling\n\nTo make accessing data returned by twitter requests simple, Swifter provides a class for representing JSON which you interact with similarly to a dictionary. The main advantage of using this instead of a Dictionary\u003cString, AnyObject\u003e is that it works better with Swift's strict typing system and doesn't require you to constantly downcast accessed objects. It also removes the need for lots of optional chaining, making your code much cleaner and easier to read.\n\nHere's an example of how you would access the text of the first element in list of statuses:\n\n```swift\nif let statusText = statuses[0][\"text\"].string {\n    // ...\n}\n```\n\n## OAuth Consumer Tokens\n\nIn Twitter REST API v1.1, each client application must authenticate itself with consumer key and consumer secret tokens. You can request consumer tokens for your app on [Twitter's dev website](https://dev.twitter.com/apps)\n\n## Single Sign-On [Deprecated]\n\nIf you authorize with SSO, you should add URL-Scheme your Info.plist.\n*REPLACE $(TWITTER_CONSUMER_KEY) TO YOUR CONSUMER KEY.*\n\n```\n\u003ckey\u003eCFBundleURLTypes\u003c/key\u003e\n\u003carray\u003e\n\t\u003cdict\u003e\n\t\t\u003ckey\u003eCFBundleTypeRole\u003c/key\u003e\n\t\t\u003cstring\u003eEditor\u003c/string\u003e\n\t\t\u003ckey\u003eCFBundleURLSchemes\u003c/key\u003e\n\t\t\u003carray\u003e\n\t\t\t\u003cstring\u003eswifter-$(TWITTER_CONSUMER_KEY)\u003c/string\u003e\n\t\t\u003c/array\u003e\n\t\u003c/dict\u003e\n\u003c/array\u003e\n```\n\n# License\n\nSwifter is licensed under the MIT License. See the LICENSE file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattdonnelly%2FSwifter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattdonnelly%2FSwifter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattdonnelly%2FSwifter/lists"}