{"id":18917787,"url":"https://github.com/oyvinddd/twitch-ios-sdk","last_synced_at":"2025-04-15T09:32:08.674Z","repository":{"id":56924641,"uuid":"284890655","full_name":"oyvinddd/twitch-ios-sdk","owner":"oyvinddd","description":"A lightweight Swift wrapper around the official Twitch API","archived":false,"fork":false,"pushed_at":"2020-08-21T15:24:42.000Z","size":262,"stargazers_count":4,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T09:49:45.547Z","etag":null,"topics":["cocoapod","cocoapods","helix","helix-api","sdk","swift5","twitch","twitch-api","twitch-api-v5","twitchtv"],"latest_commit_sha":null,"homepage":"https://dev.twitch.tv/docs/api","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/oyvinddd.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":"2020-08-04T05:58:17.000Z","updated_at":"2025-01-24T11:14:25.000Z","dependencies_parsed_at":"2022-08-20T22:20:16.035Z","dependency_job_id":null,"html_url":"https://github.com/oyvinddd/twitch-ios-sdk","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oyvinddd%2Ftwitch-ios-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oyvinddd%2Ftwitch-ios-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oyvinddd%2Ftwitch-ios-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oyvinddd%2Ftwitch-ios-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oyvinddd","download_url":"https://codeload.github.com/oyvinddd/twitch-ios-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249042988,"owners_count":21203392,"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":["cocoapod","cocoapods","helix","helix-api","sdk","swift5","twitch","twitch-api","twitch-api-v5","twitchtv"],"created_at":"2024-11-08T10:28:09.273Z","updated_at":"2025-04-15T09:32:07.989Z","avatar_url":"https://github.com/oyvinddd.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Twitch banner](/Assets/twitch-header.svg \"Twitch banner\")\n\n[![CI Status](https://img.shields.io/travis/43780301/Twitch.svg?style=flat)](https://travis-ci.org/43780301/Twitch)\n[![Version](https://img.shields.io/cocoapods/v/Twitch.svg?style=flat)](https://cocoapods.org/pods/Twitch)\n[![License](https://img.shields.io/cocoapods/l/Twitch.svg?style=flat)](https://cocoapods.org/pods/Twitch)\n[![Platform](https://img.shields.io/cocoapods/p/Twitch.svg?style=flat)](https://cocoapods.org/pods/Twitch)\n\n## Information\n\n**⚠️ THIS SOFTWARE IS UNOFFICIAL AND IS IN NO WAY ENDORSED BY TWITCH.TV ⚠️**\n\nThis SDK is a modern, lightweight wrapper around the [official Twitch API](https://dev.twitch.tv/docs/api/). Its main purpose is to make your life easier when building apps that needs to integrate with the various Twitch services. The code is 100% Swift and does not rely on any external dependencies. Deployment target has been set to **iOS 12**.\n\n## Installation\nTwitch is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'Twitch'\n```\n\n## Prerequisites\nBefore you can start using the SDK you need to [register your app](https://dev.twitch.tv/docs/authentication#registration) on the Twitch developer site.\n\n## Usage\n\n### 1. Initialization\nOnce you have registered your app and obtained a client ID you are good to go. To initialize the SDK put the following in your application's ```application(_:didFinishLaunchingWithOptions:)``` (or in the related scene delegate method):\n\n```swift\n// A configuration with redirect uri and scope(s) needs to be specified\nlet config = TWConfig(redirectUri: \"REDIRECT_URI\", scopes: [TWConfig.Scope.openid])\n// Initialize the Twitch object with client ID and configuration\nTwitch.initialize(clientId: \"CLIENT_ID\", config: config)\n```\n\n### 2. Getting an access token\n#### 2.1 OAuth Token (implicit flow)\nThe simplest way to retrieve an OAuth 2.0 access token is by using the included ```TWAuthViewController```:\n\n```swift\nfinal class MyViewController: UIViewController {\n\n    override func viewDidAppear(_ animated: Bool) {\n        super.viewDidAppear(animated)\n        // This presents a web view where the user can login to his/her Twitch account.\n        // After a successful login, the access token is stored automatically by the SDK\n        // and you can proceed to calling the Twitch API.\n        present(TWAuthViewController(delegate: self), animated: true, completion: nil)\n    }\n}\n\n// If you want a callback when the access token has been successfully retrieved,\n// you can implement the (optional) TWOAuthDelegate method below.\nextension MyViewController: TWOAuthDelegate {\n    \n    func didFetchToken(_ accessToken: String) {\n        print(\"Got an OAuth 2.0 token: \\(accessToken)\")\n    }\n}\n```\n\n### 3. Calling the API\nThe example below fetches all the top games (by number of current viewers) on Twitch.\n\n```swift\nTwitch.Games.getTopGames { result in\n    // Note! It's safe to call UI updates from this block\n    switch result {\n    case .success(let container):\n        for game in container.data {\n            print(game)\n        }\n        break\n    case .failure(let error):\n        print(error.localizedDescription)\n    }\n}\n\n// This prints the following:\n// TWGame(id: \"509658\", name: \"Just Chatting\", boxArtUrl: \"...\")\n// TWGame(id: \"21779\", name: \"League of Legends\", boxArtUrl: \"...\")\n// TWGame(id: \"33214\", name: \"Fortnite\", boxArtUrl: \"...\")\n// ...\n```\n\n## Available API Calls\n\n| API Method | Swift Function | Supported? |\n| ------------- | ------------- | :-------------: |\n| Get Cheermotes | Twitch.Bits.getCheermotes | ✅ |\n| Get Bits Leaderboard | Twitch.Bits.getBitsLeaderboard | ✅ |\n| Get Game Analytics | Twitch.Analytics.getGameAnalytics | ✅ |\n| Get Extension Transactions | Twitch.Extensions.getTransactions | ❌ |\n| Create Clip | Twitch.Clips.createClip | ✅ |\n| Get Clips | Twitch.Clips.getClips | ❌ |\n| Create Entitlement Grants Upload URL | Twitch.Entitlements.createGrantsUploadUrl | ❌ |\n| Get Code Status | Twitch.Entitlements.getCodeStatus | ✅ |\n| Redeem Code | Twitch.Entitlements.redeemCode | ✅ |\n| Get Top Games | Twitch.Games.getTopGames | ✅ |\n| Get Games | Twitch.Games.getGames | ✅ |\n| Check Automod Status | Twitch.Moderation.checkAutomodStatus | ❌ |\n| Get Banned Users | Twitch.Moderation.getBannedUsers | ✅ |\n| Get Banned Events | Twitch.Moderation.getBannedEvents | ✅ |\n| Get Moderators | Twitch.Moderation.getModerators | ✅ |\n| Get Moderator Events | Twitch.Moderation.getModeratorEvents | ✅ |\n| Search Categories | Twitch.Search.searchCategories | ✅ |\n| Search Channels | Twitch.Search.searchChannels | ✅ |\n| Get Stream Key | Twitch.Streams.getStreamKey | ✅ |\n| Get Streams | Twitch.Streams.getStreams | ✅ |\n| Create Stream Marker | Twitch.Streams.createStreamMarker | ✅ |\n| Get Stream Markers | Twitch.Streams.getStreamMarkers | ❌ |\n| Get Channel Information | Twitch.Streams.getChannelInfo | ✅ |\n| Modify Channel Information | Twitch.Streams.modifyChannelInfo | ❌ |\n| Get Broadcaster Subscriptions | Twitch.Subscriptions.getBroadcasterSubscriptions | ✅ |\n| Get All Stream Tags | Twitch.Tags.getAllStreamTags | ✅ |\n| Get Stream Tags | Twitch.Tags.getStreamTags | ✅ |\n| Replace Stream Tags | Twitch.Tags.replaceStreamTags | ❌ |\n| Create User Follows | Twitch.Users.createUserFollows | ❌ |\n| Delete User Follows | Twitch.Users.deleteUserFollows | ❌ |\n| Get Users | Twitch.Clips.getUsers | ✅ |\n| Get Users Follows | Twitch.Users.getFollows | ✅ |\n| Update User | Twitch.Clips.updateUser | ✅ |\n| Get User Extensions | Twitch.Users.getExtensions | ✅ |\n| Get User Active Extensions | Twitch.Users.getUserActiveExtensions | ❌ |\n| Update User Extensions | Twitch.Users.updateUserExtensions | ❌ |\n| Get Videos | Twitch.Videos.getVideos | ✅ |\n| Get Webhook Subscription | Twitch.Subscriptions.getWebhookSubscriptions | ✅ |\n| Get Hype Train Events | Twitch.HypeTrain.getHypeTrainEvents | ❌ |\n\n## License\nTwitch is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foyvinddd%2Ftwitch-ios-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foyvinddd%2Ftwitch-ios-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foyvinddd%2Ftwitch-ios-sdk/lists"}